15 use Elgg\Traits\Loggable;
 
   16 use Elgg\Traits\TimeUsing;
 
   94         if ($class_name && !class_exists($class_name)) {
 
   95             $this->getLogger()->error(
"Class '{$class_name}' was not found");
 
   99         if (empty($class_name)) {
 
  101                 'object' => \ElggObject::class,
 
  102                 'user' => \ElggUser::class,
 
  103                 'group' => \ElggGroup::class,
 
  104                 'site' => \ElggSite::class,
 
  106             if (isset($map[
$type])) {
 
  107                 $class_name = $map[
$type];
 
  111         if (!is_a($class_name, \ElggEntity::class, 
true)) {
 
  112             $this->getLogger()->error(
"{$class_name} must extend " . \ElggEntity::class);
 
  139         $where->guids = 
$guid;
 
  142         $select = Select::fromTable(self::TABLE_NAME, self::DEFAULT_JOIN_ALIAS);
 
  143         $select->select(
"{$select->getTableAlias()}.*");
 
  144         $select->addClause($where);
 
  146         return $this->db->getDataRow($select) ?: 
null;
 
  161         $insert = 
Insert::intoTable(self::TABLE_NAME);
 
  166             'container_guid' => $insert->param($row->container_guid, 
ELGG_VALUE_GUID),
 
  167             'access_id' => $insert->param($row->access_id, 
ELGG_VALUE_ID),
 
  173         return $this->db->insertData($insert);
 
  185         $update = 
Update::table(self::TABLE_NAME);
 
  186         $update->set(
'owner_guid', $update->param($row->owner_guid, 
ELGG_VALUE_GUID))
 
  187             ->set(
'container_guid', $update->param($row->container_guid, 
ELGG_VALUE_GUID))
 
  188             ->set(
'access_id', $update->param($row->access_id, 
ELGG_VALUE_ID))
 
  193         return $this->db->updateData($update);
 
  206         if (!isset($row->type) || !isset($row->subtype)) {
 
  210         $class_name = $this->getEntityClass($row->type, $row->subtype);
 
  215         return new $class_name($row);
 
  256         $row = $this->getRow(
$guid);
 
  269         $entity = $this->rowToElggStar($row);
 
  292             return !empty($this->getRow(
$guid));
 
  316         $preload = array_filter(
$results, 
function ($e) {
 
  317             return $e instanceof \ElggEntity;
 
  320         $this->metadata_cache->populateFromEntities($preload);
 
  322         $props_to_preload = [];
 
  324             $props_to_preload[] = 
'owner_guid';
 
  328             $props_to_preload[] = 
'container_guid';
 
  331         if (!empty($props_to_preload)) {
 
  332             _elgg_services()->entityPreloader->preload($preload, $props_to_preload);
 
  348             $deleted = $this->getCurrentTime()->getTimestamp();
 
  351         $update = Update::table(self::TABLE_NAME);
 
  355         $this->db->updateData($update);
 
  373             $posted = $this->getCurrentTime()->getTimestamp();
 
  376         $update = Update::table(self::TABLE_NAME);
 
  380         $this->db->updateData($update);
 
  394         if (empty(
$guid) || 
$guid === $this->session_manager->getLoggedInUserGuid()) {
 
  395             return $this->session_manager->getLoggedInUser();
 
  400             return $this->
get(
$guid, 
'user');
 
  406             $message = $this->translator->translate(
'UserFetchFailureException', [
$guid]);
 
  427         return $this->db->updateData(
$qb);
 
  442         return $this->db->updateData(
$qb);
 
  457         return $this->db->updateData(
$qb);
 
  482             $this->deleted_guids[] = 
$entity->guid;
 
  485                 $this->deleteRelatedEntities(
$entity);
 
  488             $this->deleteEntityProperties(
$entity);
 
  490             $qb = Delete::fromTable(self::TABLE_NAME);
 
  493             return (
bool) $this->db->deleteData(
$qb);
 
  510         if (!$this->config->trash_enabled) {
 
  511             return $this->
delete(
$entity, $recursive);
 
  520             $unban_after = 
false;
 
  527             $this->trashed_guids[] = 
$entity->guid;
 
  532                 $this->trashRelatedEntities(
$entity);
 
  536             if (!empty($deleter_guid)) {
 
  537                 $entity->addRelationship($deleter_guid, 
'deleted_by');
 
  540             $qb = Update::table(self::TABLE_NAME);
 
  544             $trashed = $this->db->updateData(
$qb);
 
  585                 'batch_inc_offset' => 
false,
 
  590                 if (in_array($e->guid, $this->deleted_guids)) {
 
  596                 if (!$e->delete(
true, 
true)) {
 
  628                 'batch_inc_offset' => 
false,
 
  633                 if (in_array($e->guid, $this->trashed_guids)) {
 
  639                 if (!$e->delete(
true, 
false)) {
 
  643                 $e->addRelationship(
$entity->guid, 
'deleted_with');
 
  658             $entity->removeAllRelatedRiverItems();
 
  659             $entity->deleteOwnedAccessCollections();
 
  660             $entity->deleteAccessCollectionMemberships();
 
  665             $entity->deleteOwnedAnnotations();
 
  671         $dir = new \Elgg\EntityDirLocator(
$entity->guid);
 
$guid
Reset an ElggUpgrade.
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'=>[],]
$attributes
Elgg AJAX loader.
Volatile cache for entities.
Builds queries for filtering entities by their properties in the entities table.
Entity table database service.
updateRow(int $guid, \stdClass $row)
Update entity table row.
fetch(QueryBuilder $query, array $options=[])
Returns an array of entities with optional filtering.
insertRow(\stdClass $row, array $attributes=[])
Adds a new row to the entity table.
invalidateCache(int $guid)
Invalidate cache for entity.
getUserForPermissionsCheck(?int $guid=null)
Get a user by GUID even if the entity is hidden or disabled.
setEntityClass(string $type, string $subtype, string $class='')
Sets class constructor name for entities with given type and subtype.
deleteRelatedEntities(\ElggEntity $entity)
Deletes entities owned or contained by the entity being deletes.
getEntityClass(string $type, string $subtype)
Returns class name registered as a constructor for a given type and subtype The classname is also val...
__construct(protected Config $config, protected Database $db, protected EntityCache $entity_cache, protected MetadataCache $metadata_cache, protected EventsService $events, protected SessionManagerService $session_manager, protected Translator $translator)
Constructor.
exists(int $guid)
Does an entity exist?
updateLastAction(\ElggEntity $entity, ?int $posted=null)
Update the last_action column in the entities table for $entity.
rowToElggStar(\stdClass $row)
Create an Elgg* object from a given entity row.
trash(\ElggEntity $entity, bool $recursive=true)
Trash an entity (not quite delete but close)
enable(\ElggEntity $entity)
Enables entity.
getRow(int $guid, ?int $user_guid=null)
Returns a database row from the entities table.
restore(\ElggEntity $entity)
Restore entity.
deleteEntityProperties(\ElggEntity $entity)
Clear data from secondary tables.
updateTimeDeleted(\ElggEntity $entity, ?int $deleted=null)
Update the time_deleted column in the entities table for $entity.
trashRelatedEntities(\ElggEntity $entity)
Trash entities owned or contained by the entity being trashed.
disable(\ElggEntity $entity)
Disables entity.
Query builder for inserting data into the database.
Database abstraction query builder.
Query builder for updating data in the database.
Exception indicating a user could not be looked up for a permissions check.
Exception thrown if a value does not adhere to a defined valid data domain.
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_SHOW_DISABLED_ENTITIES
const ELGG_DISABLE_SYSTEM_LOG
const ELGG_VALUE_TIMESTAMP
const ELGG_SHOW_DELETED_ENTITIES
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
$config
Advanced site settings, debugging section.
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
_elgg_services()
Get the global service provider.
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
elgg_delete_directory(string $directory, bool $leave_base_directory=false)
Delete a directory and all its contents.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.