Elgg  Version master
Database.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Application;
4 
5 use Doctrine\DBAL\Connection;
6 use Doctrine\DBAL\Query\QueryBuilder;
7 use Elgg\Database as ElggDb;
8 
16 class Database {
17 
23  public function __construct(protected ElggDb $db) {
24  }
25 
41  public function getData(QueryBuilder $query, $callback = '') {
42  return $this->db->getData($query, $callback);
43  }
44 
57  public function getDataRow(QueryBuilder $query, $callback = '') {
58  return $this->db->getDataRow($query, $callback);
59  }
60 
71  public function insertData(QueryBuilder $query) {
72  return $this->db->insertData($query);
73  }
74 
85  public function updateData(QueryBuilder $query, bool $getNumRows = false) {
86  return $this->db->updateData($query, $getNumRows);
87  }
88 
98  public function deleteData(QueryBuilder $query): int {
99  return $this->db->deleteData($query);
100  }
101 
110  public function getConnection($type) {
111  return $this->db->getConnection($type);
112  }
113 
126  public function registerDelayedQuery(QueryBuilder $query, $callback = null): void {
127  $this->db->registerDelayedQuery($query, $callback);
128  }
129 
136  public function __get($name) {
137  return $this->db->{$name};
138  }
139 
147  public function __set($name, $value) {
148  $this->db->{$name} = $value;
149  }
150 }
if(! $user||! $user->canDelete()) $name
Definition: delete.php:22
$type
Definition: delete.php:21
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
$query
__construct(protected ElggDb $db)
Constructor.
Definition: Database.php:23
updateData(QueryBuilder $query, bool $getNumRows=false)
Update the database.
Definition: Database.php:85
registerDelayedQuery(QueryBuilder $query, $callback=null)
Queue a query for execution upon shutdown.
Definition: Database.php:126
deleteData(QueryBuilder $query)
Delete data from the database.
Definition: Database.php:98
insertData(QueryBuilder $query)
Insert a row into the database.
Definition: Database.php:71
__get($name)
Handle magic property reads.
Definition: Database.php:136
getConnection($type)
Gets (if required, also creates) a DB connection.
Definition: Database.php:110
__set($name, $value)
Handle magic property writes.
Definition: Database.php:147
getDataRow(QueryBuilder $query, $callback='')
Retrieve a single row from the database.
Definition: Database.php:57
getData(QueryBuilder $query, $callback='')
Retrieve rows from the database.
Definition: Database.php:41
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
$value
Definition: generic.php:51