// avoid side effects \OC_User::setIncognitoMode(true); $l = new \OC_L10N('core'); $eventSource = \OC::$server->createEventSource(); $logger = \OC::$server->getLogger(); $updater = new \OC\Updater( \OC::$server->getHTTPHelper(), \OC::$server->getConfig(), $logger ); $incompatibleApps = []; $disabledThirdPartyApps = []; $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned off maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Maintenance mode is kept active')); }); $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated database')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update')); }); $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
<?php set_time_limit(0); require_once '../../lib/base.php'; if (OC::checkUpgrade(false)) { $l = new \OC_L10N('core'); $eventSource = new OC_EventSource(); $updater = new \OC\Updater(\OC_Log::$object); $updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned off maintenance mode')); }); $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated database')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update')); }); $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update for apps')); }); $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated "%s" to %s', array($app, $version))); }); $updater->listen('\OC\Updater', 'disabledApps', function ($appList) use ($eventSource, $l) { $list = array(); foreach ($appList as $appId) { $info = OC_App::getAppInfo($appId); $list[] = $info['name'] . ' (' . $info['id'] . ')';
<?php set_time_limit(0); $RUNTIME_NOAPPS = true; require_once '../../lib/base.php'; if (OC::checkUpgrade(false)) { $l = new \OC_L10N('core'); $eventSource = new OC_EventSource(); $updater = new \OC\Updater(\OC_Log::$object); $updater->listen('\\OC\\Updater', 'maintenanceStart', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Turned on maintenance mode')); }); $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Turned off maintenance mode')); }); $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Updated database')); }); $updater->listen('\\OC\\Updater', 'filecacheStart', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Updating filecache, this may take really long...')); }); $updater->listen('\\OC\\Updater', 'filecacheDone', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Updated filecache')); }); $updater->listen('\\OC\\Updater', 'filecacheProgress', function ($out) use($eventSource, $l) { $eventSource->send('success', (string) $l->t('... %d%% done ...', array('percent' => $out))); }); $updater->listen('\\OC\\Updater', 'failure', function ($message) use($eventSource) { $eventSource->send('failure', $message); $eventSource->close(); OC_Config::setValue('maintenance', false);
$eventSource = \OC::$server->createEventSource(); // need to send an initial message to force-init the event source, // which will then trigger its own CSRF check and produces its own CSRF error // message $eventSource->send('success', (string) $l->t('Preparing update')); if (OC::checkUpgrade(false)) { // if a user is currently logged in, their session must be ignored to // avoid side effects \OC_User::setIncognitoMode(true); $logger = \OC::$server->getLogger(); $config = \OC::$server->getConfig(); $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), $config, \OC::$server->getIntegrityCodeChecker(), $logger); $incompatibleApps = []; $disabledThirdPartyApps = []; $updater->listen('\\OC\\Updater', 'maintenanceEnabled', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Turned on maintenance mode')); }); $updater->listen('\\OC\\Updater', 'maintenanceDisabled', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Turned off maintenance mode')); }); $updater->listen('\\OC\\Updater', 'maintenanceActive', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Maintenance mode is kept active')); }); $updater->listen('\\OC\\Updater', 'dbUpgradeBefore', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Updating database schema')); }); $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Updated database')); }); $updater->listen('\\OC\\Updater', 'dbSimulateUpgradeBefore', function () use($eventSource, $l) { $eventSource->send('success', (string) $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));