Elgg  Version 3.0
Namespaces | Functions | Variables
database.php File Reference

Go to the source code of this file.

Namespaces

 Elgg\Core
 Updates the advanced settings for the primary site object.
 

Functions

 execute_delayed_write_query ($query, $callback=null, array $params=[])
 Queue a query for running during shutdown that writes to the database. More...
 
 execute_delayed_read_query ($query, $callback=null, array $params=[])
 Queue a query for running during shutdown that reads from the database. More...
 
 run_sql_script ($scriptlocation)
 Runs a full database script from disk. More...
 
 elgg_enable_query_cache ()
 Enable the MySQL query cache. More...
 
 elgg_disable_query_cache ()
 Disable the MySQL query cache. More...
 
 _elgg_db_test ($hook, $type, $value)
 Runs unit tests for the database. More...
 
 _elgg_db_register_seeds (\Elgg\Hook $hook)
 Register database seeds. More...
 
 _elgg_db_init ()
 Registers shutdown functions for database profiling and delayed queries. More...
 

Variables

return function (\Elgg\EventsService $events,\Elgg\HooksRegistrationService $hooks)
 

Function Documentation

_elgg_db_init ( )

Registers shutdown functions for database profiling and delayed queries.

Returns
void

Definition at line 128 of file database.php.

_elgg_db_register_seeds ( \Elgg\Hook  $hook)

Register database seeds.

seeds database

Parameters
\Elgg\Hook$hookHook
Returns
array

Definition at line 111 of file database.php.

_elgg_db_test (   $hook,
  $type,
  $value 
)

Runs unit tests for the database.

Parameters
string$hook'unit_test'
string$type'system'
array$valueArray of tests
Returns
array

Definition at line 98 of file database.php.

elgg_disable_query_cache ( )

Disable the MySQL query cache.

Note
Elgg already manages the query cache sensibly, so you probably don't need to use this.
Returns
void
Since
2.0.0

Definition at line 83 of file database.php.

elgg_enable_query_cache ( )

Enable the MySQL query cache.

Returns
void
Since
2.0.0

Definition at line 70 of file database.php.

execute_delayed_read_query (   $query,
  $callback = null,
array  $params = [] 
)

Queue a query for running during shutdown that reads from the database.

Parameters
string$queryThe query to execute
callable$callbackThe optional callback for processing. The callback will receive a object
array$paramsQuery params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve']
Returns
boolean

Definition at line 35 of file database.php.

execute_delayed_write_query (   $query,
  $callback = null,
array  $params = [] 
)

Queue a query for running during shutdown that writes to the database.

Parameters
string$queryThe query to execute
callable$callbackThe optional callback for processing. The callback will receive a object
array$paramsQuery params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve']
Returns
boolean

Definition at line 21 of file database.php.

run_sql_script (   $scriptlocation)

Runs a full database script from disk.

The file specified should be a standard SQL file as created by mysqldump or similar. Statements must be terminated with ; and a newline character (
or
) with only one statement per line.

The special string 'prefix_' is replaced with the database prefix as defined in ->dbprefix.

Warning
Errors do not halt execution of the script. If a line generates an error, the error message is saved and the next line is executed. After the file is run, any errors are displayed as a DatabaseException
Parameters
string$scriptlocationThe full path to the script
Returns
void
Exceptions
DatabaseException

Definition at line 59 of file database.php.

Variable Documentation

See also
::loadCore Do not do work here. Just register for events.

Definition at line 136 of file database.php.