nextcloud/core/ajax/update.php

38 lines
1.4 KiB
PHP
Raw Normal View History

<?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) {
2013-07-06 19:00:00 +04:00
$eventSource = new OC_EventSource();
$updater = new \OC\Updater(\OC_Log::$object);
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource) {
$eventSource->send('success', 'Turned on maintenance mode');
});
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use ($eventSource) {
$eventSource->send('success', 'Turned off maintenance mode');
});
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource) {
$eventSource->send('success', 'Updated database');
});
$updater->listen('\OC\Updater', 'filecacheStart', function () use ($eventSource) {
$eventSource->send('success', 'Updating filecache, this may take really long...');
});
$updater->listen('\OC\Updater', 'filecacheDone', function () use ($eventSource) {
$eventSource->send('success', 'Updated filecache');
});
$updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use ($eventSource) {
$eventSource->send('success', '... ' . $out . '% done ...');
});
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) {
$eventSource->send('failure', $message);
$eventSource->close();
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
2013-07-06 19:00:00 +04:00
$eventSource->send('done', '');
$eventSource->close();
}