Elgg  Version 3.0
database.php
Go to the documentation of this file.
1 <?php
21 function execute_delayed_write_query($query, $callback = null, array $params = []) {
22  return _elgg_services()->db->registerDelayedQuery($query, 'write', $callback, $params);
23 }
24 
35 function execute_delayed_read_query($query, $callback = null, array $params = []) {
36  return _elgg_services()->db->registerDelayedQuery($query, 'read', $callback, $params);
37 }
38 
59 function run_sql_script($scriptlocation) {
60  _elgg_services()->db->runSqlScript($scriptlocation);
61 }
62 
71  _elgg_services()->queryCache->enable();
72 }
73 
84  _elgg_services()->queryCache->disable();
85 }
86 
98 function _elgg_db_test($hook, $type, $value) {
100  return $value;
101 }
102 
111 function _elgg_db_register_seeds(\Elgg\Hook $hook) {
112 
113  $seeds = $hook->getValue();
114 
117 
118  return $seeds;
119 }
120 
128 function _elgg_db_init() {
129  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_db_test');
130  elgg_register_plugin_hook_handler('seeds', 'database', '_elgg_db_register_seeds');
131 }
132 
136 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
137  $events->registerHandler('init', 'system', '_elgg_db_init');
138 };
_elgg_db_test($hook, $type, $value)
Runs unit tests for the database.
Definition: database.php:98
$query
Definition: groups.php:8
$params
Saves global plugin settings.
Definition: save.php:13
elgg_disable_query_cache()
Disable the MySQL query cache.
Definition: database.php:83
Events service.
$type
Definition: delete.php:21
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:634
Configuration exception.
Base class for events and hooks.
elgg_enable_query_cache()
Enable the MySQL query cache.
Definition: database.php:70
execute_delayed_write_query($query, $callback=null, array $params=[])
Queue a query for running during shutdown that writes to the database.
Definition: database.php:21
_elgg_db_register_seeds(\Elgg\Hook $hook)
Register database seeds.
Definition: database.php:111
_elgg_db_init()
Registers shutdown functions for database profiling and delayed queries.
Definition: database.php:128
run_sql_script($scriptlocation)
Runs a full database script from disk.
Definition: database.php:59
$value
Definition: debugging.php:7
class
Definition: placeholder.php:21
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
execute_delayed_read_query($query, $callback=null, array $params=[])
Queue a query for running during shutdown that reads from the database.
Definition: database.php:35