Blame view
sources/core/ajax/update.php
1.49 KB
|
03e52840d
|
1 2 |
<?php set_time_limit(0); |
|
03e52840d
|
3 4 5 |
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
|
|
31b7f2792
|
6 |
$l = new \OC_L10N('core');
|
|
03e52840d
|
7 |
$eventSource = new OC_EventSource(); |
|
31b7f2792
|
8 9 10 |
$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'));
|
|
03e52840d
|
11 |
}); |
|
31b7f2792
|
12 13 |
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
|
|
03e52840d
|
14 |
}); |
|
31b7f2792
|
15 16 |
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database'));
|
|
03e52840d
|
17 |
}); |
|
6d9380f96
|
18 19 |
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update'));
|
|
03e52840d
|
20 |
}); |
|
6d9380f96
|
21 22 23 24 25 26 27 |
$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'] . ')';
}
$eventSource->send('success', (string)$l->t('Disabled incompatible apps: %s', implode(', ', $list)));
|
|
03e52840d
|
28 |
}); |
|
31b7f2792
|
29 |
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
|
|
03e52840d
|
30 31 32 33 |
$eventSource->send('failure', $message);
$eventSource->close();
OC_Config::setValue('maintenance', false);
});
|
|
31b7f2792
|
34 |
|
|
03e52840d
|
35 36 37 38 |
$updater->upgrade();
$eventSource->send('done', '');
$eventSource->close();
|
|
31b7f2792
|
39 |
} |