2013-01-04 06:32:33 +04:00
|
|
|
<?php
|
|
|
|
set_time_limit(0);
|
2014-08-22 13:39:05 +04:00
|
|
|
require_once '../../lib/base.php';
|
2013-01-04 06:32:33 +04:00
|
|
|
|
|
|
|
if (OC::checkUpgrade(false)) {
|
2014-09-02 16:30:46 +04:00
|
|
|
// if a user is currently logged in, their session must be ignored to
|
|
|
|
// avoid side effects
|
|
|
|
\OC_User::setIncognitoMode(true);
|
|
|
|
|
2013-08-27 02:26:44 +04:00
|
|
|
$l = new \OC_L10N('core');
|
2014-09-04 03:10:02 +04:00
|
|
|
$eventSource = \OC::$server->createEventSource();
|
2014-11-25 22:41:15 +03:00
|
|
|
$updater = new \OC\Updater(
|
2014-12-10 01:13:38 +03:00
|
|
|
\OC::$server->getHTTPHelper(),
|
2015-02-17 14:00:39 +03:00
|
|
|
\OC::$server->getConfig(),
|
2014-11-25 22:41:15 +03:00
|
|
|
\OC_Log::$object
|
|
|
|
);
|
2015-02-17 14:00:39 +03:00
|
|
|
$incompatibleApps = [];
|
|
|
|
$disabledThirdPartyApps = [];
|
|
|
|
|
2013-08-27 02:26:44 +04:00
|
|
|
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
|
|
|
|
$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
|
2013-07-06 19:00:00 +04:00
|
|
|
});
|
2013-08-27 02:26:44 +04:00
|
|
|
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
|
|
|
|
$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
|
2013-07-06 19:00:00 +04:00
|
|
|
});
|
2013-08-27 02:26:44 +04:00
|
|
|
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
|
|
|
|
$eventSource->send('success', (string)$l->t('Updated database'));
|
2013-07-06 19:00:00 +04:00
|
|
|
});
|
2014-06-04 18:40:53 +04:00
|
|
|
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
|
|
|
|
$eventSource->send('success', (string)$l->t('Checked database schema update'));
|
|
|
|
});
|
2014-07-24 19:51:41 +04:00
|
|
|
$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)));
|
|
|
|
});
|
2015-02-17 14:00:39 +03:00
|
|
|
$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
|
|
|
|
$incompatibleApps[]= $app;
|
|
|
|
});
|
|
|
|
$updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use (&$disabledThirdPartyApps) {
|
|
|
|
$disabledThirdPartyApps[]= $app;
|
2014-05-27 17:20:33 +04:00
|
|
|
});
|
2013-07-06 19:00:00 +04:00
|
|
|
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
|
|
|
|
$eventSource->send('failure', $message);
|
|
|
|
$eventSource->close();
|
2013-04-09 22:51:43 +04:00
|
|
|
OC_Config::setValue('maintenance', false);
|
2013-07-06 19:00:00 +04:00
|
|
|
});
|
2013-01-04 19:21:33 +04:00
|
|
|
|
2013-07-06 19:00:00 +04:00
|
|
|
$updater->upgrade();
|
2013-01-04 19:21:33 +04:00
|
|
|
|
2015-02-17 14:00:39 +03:00
|
|
|
if (!empty($incompatibleApps)) {
|
|
|
|
$eventSource->send('notice',
|
|
|
|
(string)$l->t('Following incompatible apps have been disabled: %s', implode(', ', $incompatibleApps)));
|
|
|
|
}
|
|
|
|
if (!empty($disabledThirdPartyApps)) {
|
|
|
|
$eventSource->send('notice',
|
|
|
|
(string)$l->t('Following 3rd party apps have been disabled: %s', implode(', ', $disabledThirdPartyApps)));
|
|
|
|
}
|
|
|
|
|
2013-07-06 19:00:00 +04:00
|
|
|
$eventSource->send('done', '');
|
|
|
|
$eventSource->close();
|
|
|
|
}
|