30 private $requiredProperties = [
49 parent::initializeAttributes();
51 $this->attributes[
'subtype'] =
'elgg_upgrade';
54 $this->attributes[
'container_guid'] = 0;
55 $this->attributes[
'owner_guid'] = 0;
65 $this->is_completed =
true;
76 return (
bool) $this->is_completed;
117 $loglevel = $this->
isCompleted() ?
'INFO' :
'ERROR';
118 elgg_log($ex->getMessage(), $loglevel);
127 if (preg_match(
"/^[0-9]{10}$/",
$version) == 0) {
128 elgg_log(
"Upgrade $this->class returned an invalid version: $version");
143 if (!is_int(
$time)) {
147 return $this->completed_time =
$time;
156 return $this->completed_time;
166 if (!isset($this->is_completed)) {
167 $this->is_completed =
false;
170 foreach ($this->requiredProperties as $prop) {
176 return parent::save();
189 if (array_key_exists(
$name, $this->attributes)) {
204 if (array_key_exists(
$name, $this->attributes)) {
205 return parent::__get(
$name);
216 if (array_key_exists(
$name, $this->attributes)) {
217 return parent::__isset(
$name);
221 return !is_null($private_setting);
if(!$user||!$user->canDelete()) $name
isCompleted()
Has this upgrade completed?
__get($name)
Get an attribute or private setting value.
setPrivateSetting($name, $value)
Adds a private setting to this entity.
getPrivateSetting($name)
Returns a private setting value.
getCurrentTime($modifier= '')
Get the (cloned) time.
isAsynchronous()
Check if the upgrade should be run asynchronously.
initializeAttributes()
Set subtype to upgrade.
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
getCompletedTime()
Gets the time when the upgrade completed.
getBatch()
Return instance of the class that processes the data.
$id
River item delete action.
setID($id)
Sets an unique id for the upgrade.
if(!$entity instanceof ElggEntity) $time
save()
Require an upgrade page.
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
__set($name, $value)
Set a value as private setting or attribute.
setCompleted()
Mark this upgrade as completed.
setCompletedTime($time=null)
Sets the timestamp for when the upgrade completed.
setClass($class)
Sets a class for the upgrade.
_elgg_services()
Get the global service provider.
trait TimeUsing
Adds methods for setting the current time (for testing)
elgg_trigger_event($event, $object_type, $object=null)