Blame view
sources/core/ajax/update.php
1.53 KB
|
03e52840d
|
1 2 3 4 5 6 |
<?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
|
|
31b7f2792
|
7 |
$l = new \OC_L10N('core');
|
|
03e52840d
|
8 |
$eventSource = new OC_EventSource(); |
|
31b7f2792
|
9 10 11 |
$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
|
12 |
}); |
|
31b7f2792
|
13 14 |
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
|
|
03e52840d
|
15 |
}); |
|
31b7f2792
|
16 17 |
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database'));
|
|
03e52840d
|
18 |
}); |
|
31b7f2792
|
19 20 |
$updater->listen('\OC\Updater', 'filecacheStart', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updating filecache, this may take really long...'));
|
|
03e52840d
|
21 |
}); |
|
31b7f2792
|
22 23 |
$updater->listen('\OC\Updater', 'filecacheDone', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated filecache'));
|
|
03e52840d
|
24 |
}); |
|
31b7f2792
|
25 26 |
$updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('... %d%% done ...', array('percent' => $out)));
|
|
03e52840d
|
27 |
}); |
|
31b7f2792
|
28 |
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
|
|
03e52840d
|
29 30 31 32 |
$eventSource->send('failure', $message);
$eventSource->close();
OC_Config::setValue('maintenance', false);
});
|
|
31b7f2792
|
33 |
|
|
03e52840d
|
34 35 36 37 |
$updater->upgrade();
$eventSource->send('done', '');
$eventSource->close();
|
|
31b7f2792
|
38 |
} |