server/core/ajax/update.php

39 lines
1.5 KiB
PHP
Raw Normal View History

<?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
2013-08-26 22:26:44 +00:00
$l = new \OC_L10N('core');
2013-07-06 15:00:00 +00:00
$eventSource = new OC_EventSource();
$updater = new \OC\Updater(\OC_Log::$object);
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
2013-07-06 15:00:00 +00:00
});
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
2013-07-06 15:00:00 +00:00
});
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database'));
2013-07-06 15:00:00 +00:00
});
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'filecacheStart', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updating filecache, this may take really long...'));
2013-07-06 15:00:00 +00:00
});
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'filecacheDone', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated filecache'));
2013-07-06 15:00:00 +00:00
});
2013-08-26 22:26:44 +00:00
$updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('... %d%% done ...', array('percent' => $out)));
2013-07-06 15:00:00 +00:00
});
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
$eventSource->send('failure', $message);
$eventSource->close();
OC_Config::setValue('maintenance', false);
2013-07-06 15:00:00 +00:00
});
2013-01-04 15:21:33 +00:00
2013-07-06 15:00:00 +00:00
$updater->upgrade();
2013-01-04 15:21:33 +00:00
2013-07-06 15:00:00 +00:00
$eventSource->send('done', '');
$eventSource->close();
}