diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-03 21:32:33 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-03 21:32:33 -0500 |
commit | 75058370795fda4f06f589ee970edf94dc0ddf88 (patch) | |
tree | 9843807302eb565e6d7125e857117bdca7cd216c /core/ajax/update.php | |
parent | a52aa69ffe5f6d00de7855c9a376f347c03b99f7 (diff) | |
download | nextcloud-server-75058370795fda4f06f589ee970edf94dc0ddf88.tar.gz nextcloud-server-75058370795fda4f06f589ee970edf94dc0ddf88.zip |
Basic update progress of database update only
Diffstat (limited to 'core/ajax/update.php')
-rw-r--r-- | core/ajax/update.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/ajax/update.php b/core/ajax/update.php new file mode 100644 index 00000000000..6f5398f41cb --- /dev/null +++ b/core/ajax/update.php @@ -0,0 +1,36 @@ +<?php +set_time_limit(0); +$RUNTIME_NOAPPS = true; +require_once '../../lib/base.php'; + +if (OC::checkUpgrade(false)) { + $updateEventSource = new OC_EventSource(); + $updateEventSource->send('success', 'Turned on maintenance mode'); + // Check if the .htaccess is existing - this is needed for upgrades from really old ownCloud versions + if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) { + if (!OC_Util::ishtaccessworking()) { + if (!file_exists(OC::$SERVERROOT . '/data/.htaccess')) { + OC_Setup::protectDataDirectory(); + } + } + } + $result = OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml'); + if (!$result) { + $updateEventSource->send('failure', 'Error updating database'); + $updateEventSource->close(); + die(); + } + $updateEventSource->send('success', 'Updated database'); + $minimizerCSS = new OC_Minimizer_CSS(); + $minimizerCSS->clearCache(); + $minimizerJS = new OC_Minimizer_JS(); + $minimizerJS->clearCache(); + OC_Config::setValue('version', implode('.', OC_Util::getVersion())); + OC_App::checkAppsRequirements(); + // load all apps to also upgrade enabled apps + OC_App::loadApps(); + OC_Config::setValue('maintenance', false); + $updateEventSource->send('success', 'Turned off maintenance mode'); + $updateEventSource->send('done', 'done'); + $updateEventSource->close(); +}
\ No newline at end of file |