Move start of the maintenance mode to the ajax call

Make sure the update page is shown in a browser. And not an ajax request
This commit is contained in:
Bart Visscher 2013-04-09 20:51:43 +02:00
Родитель 4f6565d8e7
Коммит 41f7eb948a
2 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -5,6 +5,8 @@ require_once '../../lib/base.php';
if (OC::checkUpgrade(false)) { if (OC::checkUpgrade(false)) {
\OC_DB::enableCaching(false); \OC_DB::enableCaching(false);
OC_Config::setValue('maintenance', true);
OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::WARN);
$updateEventSource = new OC_EventSource(); $updateEventSource = new OC_EventSource();
$watcher = new UpdateWatcher($updateEventSource); $watcher = new UpdateWatcher($updateEventSource);
OC_Hook::connect('update', 'success', $watcher, 'success'); OC_Hook::connect('update', 'success', $watcher, 'success');
@ -99,6 +101,7 @@ class UpdateWatcher {
OC_Util::obEnd(); OC_Util::obEnd();
$this->eventSource->send('failure', $message); $this->eventSource->send('failure', $message);
$this->eventSource->close(); $this->eventSource->close();
OC_Config::setValue('maintenance', false);
die(); die();
} }

Просмотреть файл

@ -282,10 +282,6 @@ class OC {
$currentVersion = implode('.', OC_Util::getVersion()); $currentVersion = implode('.', OC_Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) { if (version_compare($currentVersion, $installedVersion, '>')) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) { if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
OC_Config::setValue('maintenance', true);
OC_Log::write('core',
'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion,
OC_Log::WARN);
$minimizerCSS = new OC_Minimizer_CSS(); $minimizerCSS = new OC_Minimizer_CSS();
$minimizerCSS->clearCache(); $minimizerCSS->clearCache();
$minimizerJS = new OC_Minimizer_JS(); $minimizerJS = new OC_Minimizer_JS();