9 use Elgg\Traits\Loggable;
 
   13 use React\Promise\PromiseInterface;
 
   14 use 
function React\Promise\all;
 
   15 use React\Promise\Deferred;
 
   16 use React\Promise\Promise;
 
   54     protected function up(): Promise {
 
   55         return new Promise(function ($resolve, $reject) {
 
   56             Application::migrate();
 
   58             if (!$this->events->triggerBefore(
'upgrade', 
'system', 
null)) {
 
   59                 return $reject(
new \
RuntimeException($this->translator->translate(
'upgrade:terminated')));
 
   63             if (!$this->mutex->lock(
'upgrade')) {
 
   64                 return $reject(
new \
RuntimeException($this->translator->translate(
'upgrade:locked')));
 
   71             return $resolve(
true);
 
   80     protected function down(): Promise {
 
   81         return new Promise(function ($resolve, $reject) {
 
   82             if (!$this->events->trigger(
'upgrade', 
'system', 
null)) {
 
   83                 return $reject(
false);
 
   88             $this->mutex->unlock(
'upgrade');
 
   90             $this->events->triggerAfter(
'upgrade', 
'system', 
null);
 
   92             return $resolve(
true);
 
  111             $promises[] = 
new Promise(
function ($resolve, $reject) use (
$upgrade) {
 
  114                 } 
catch (\Throwable $ex) {
 
  118                 if (
$result->getFailureCount()) {
 
  119                     $msg = 
elgg_echo(
'admin:upgrades:failed', [
 
  130         return all($promises);
 
  142         set_time_limit(3600);
 
  144         $deferred = 
new Deferred();
 
  146         $promise = $deferred->promise();
 
  148         $resolve = 
function (
$value) use ($deferred) {
 
  149             $deferred->resolve(
$value);
 
  152         $reject = 
function (
$error) use ($deferred) {
 
  153             $deferred->reject(
$error);
 
  157             $upgrades = $this->getPendingUpgrades(
false);
 
  161             function () use ($resolve, $reject, 
$upgrades) {
 
  165                     function () use ($resolve, $reject) {
 
  167                             function (
$result) use ($resolve) {
 
  227             function () use ($async) {
 
  231                 $order_by_completed_time->direction = 
'DESC';
 
  232                 $order_by_completed_time->property = 
'completed_time';
 
  236                     'subtype' => 
'elgg_upgrade',
 
  237                     'metadata_name' => 
'class', 
 
  238                     'metadata_name_value_pairs' => [
 
  239                         'name' => 
'is_completed',
 
  242                     'order_by' => $order_by_completed_time,
 
  281             function () use (
$upgrade, $max_duration) {
 
  282                 return $this->events->triggerResultsSequence(
'upgrade:execute', 
'system', [
'object' => 
$upgrade], 
null, 
function() use (
$upgrade, $max_duration) {
 
  292                     $loop->loop($max_duration);
 
if(empty($guid)) $upgrade
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'=>[],]
elgg_clear_caches()
Clear all the registered caches.
elgg_invalidate_caches()
Invalidate all the registered caches.
Represents an upgrade that runs outside of the upgrade.php script.
static disable()
Disables the caches in the system.
Extends QueryBuilder with clauses necessary to sort entity lists by entity properties.
Provides database mutex that can be used to prevent race conditions between two processes that affect...
Exception thrown if an error which can only be found on runtime occurs.
Upgrade service for Elgg.
getCompletedUpgrades(bool $async=true)
Get completed (async) upgrades ordered by recently completed first.
run($upgrades=null)
Run the upgrade process.
down()
Finish an upgrade process.
runUpgrades($upgrades)
Run system and async upgrades.
getPendingUpgrades(bool $async=true)
Get pending async upgrades.
executeUpgrade(\ElggUpgrade $upgrade, ?int $max_duration=null)
Call the upgrade's run() for a specified period of time, or until it completes.
up()
Start an upgrade process.
__construct(protected Locator $locator, protected Translator $translator, protected EventsService $events, protected Config $config, protected Mutex $mutex, protected SystemMessagesService $system_messages, protected Progress $progress)
Constructor.
Locates and registers both core and plugin upgrades.
Upgrade loop Executes upgrade batches for a given duration of time.
Result of a single BatchUpgrade run.
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_SHOW_DISABLED_ENTITIES
const ELGG_SHOW_DELETED_ENTITIES
$config
Advanced site settings, debugging section.
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
$mutex
Unlocks the upgrade script.
$upgrades
Lists pending upgrades.