9 use Elgg\Traits\TimeUsing;
30 private $requiredProperties = [
43 parent::initializeAttributes();
45 $this->attributes[
'subtype'] =
'elgg_upgrade';
48 $this->attributes[
'container_guid'] = 0;
49 $this->attributes[
'owner_guid'] = 0;
60 $this->is_completed =
true;
71 return (bool) $this->is_completed;
99 return !is_subclass_of($this->class, \
Elgg\Upgrade\SystemUpgrade::class);
110 }
catch (ElggInvalidArgumentException $ex) {
112 $loglevel = $this->isCompleted() ? \Psr\Log\LogLevel::INFO : \Psr\Log\LogLevel::ERROR;
113 elgg_log($ex->getMessage(), $loglevel);
122 if (preg_match(
'/^[0-9]{10}$/',
$version) === 0) {
123 elgg_log(
"Upgrade {$this->class} returned an invalid version: {$version}");
138 $this->completed_time =
$time ?? $this->getCurrentTime()->getTimestamp();
147 return (int) $this->completed_time;
156 unset($this->is_completed);
157 unset($this->completed_time);
158 unset($this->processed);
159 unset($this->offset);
160 unset($this->start_time);
172 if (isset($this->start_time)) {
176 $this->start_time =
$time ?? $this->getCurrentTime()->getTimestamp();
185 return (
int) $this->start_time;
193 if (!isset($this->is_completed)) {
194 $this->is_completed =
false;
197 foreach ($this->requiredProperties as $prop) {
199 throw new ElggUnexpectedValueException(
"ElggUpgrade objects must have a value for the {$prop} property.");
203 return parent::save();
$id
Generic annotation delete action.
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'=>[],]
if(! $annotation instanceof ElggAnnotation) $time
Represents an upgrade that runs outside of the upgrade.php script.
getBatch()
Return instance of the class that processes the data.
getDisplayName()
{{Get the entity's display name.string The title or name of this entity.}}
setCompleted()
Mark this upgrade as completed.
initializeAttributes()
Set subtype to upgrade.
getCompletedTime()
Gets the time when the upgrade completed.
save()
Save this data to the appropriate database table.bool
isCompleted()
Has this upgrade completed?
setStartTime(?int $time=null)
Sets the timestamp for when the upgrade started.
setCompletedTime(?int $time=null)
Sets the timestamp for when the upgrade completed.
getStartTime()
Gets the time when the upgrade completed.
reset()
Resets the update in order to be able to run it again.
isAsynchronous()
Check if the upgrade should be run asynchronously.
setClass(string $class)
Sets a class for the upgrade.
setID(string $id)
Sets an unique id for the upgrade.
Exception thrown if an argument is not of the expected type.
Exception thrown if a value does not match with a set of values.
Long running upgrades should implement this interface.
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
_elgg_services()
Get the global service provider.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
elgg_trigger_event(string $event, string $type, $object=null)
Trigger an Elgg Event and attempt to run all handler callbacks registered to that event,...
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.