]> source.dussan.org Git - nextcloud-server.git/commitdiff
Squashed commit of the following:
authorThomas Mueller <thomas.mueller@tmit.eu>
Fri, 14 Jun 2013 11:34:01 +0000 (13:34 +0200)
committerThomas Mueller <thomas.mueller@tmit.eu>
Fri, 14 Jun 2013 11:34:01 +0000 (13:34 +0200)
commit 85043af59846edd54b6f402829a698142fdb412f
Author: Michael Gapczynski <mtgap@owncloud.com>
Date:   Sat May 25 11:25:43 2013 -0400

    Clear opcode caches after writing to the config file, fixes #3372

commit e96ca0a217112a612e5018fb06115879be634f0b
Author: Michael Gapczynski <mtgap@owncloud.com>
Date:   Fri May 17 11:15:53 2013 -0400

    Add undefined verision variables

commit d7faeea0b8a79bcd84255120e396280fe62c8aa1
Author: Michael Gapczynski <mtgap@owncloud.com>
Date:   Tue May 14 09:34:01 2013 -0400

    Turn off theme before update

commit f620df4e88201a8d35ecb6173f258d5e5f67c7f9
Author: Bart Visscher <bartv@thisnet.nl>
Date:   Tue Apr 16 08:07:44 2013 +0200

    Also check for needed upgrade in the Sabre Maintenance connector

commit 223cfce8c89663beb95cf7438f47cea4bac6e0de
Author: Bart Visscher <bartv@thisnet.nl>
Date:   Tue Apr 9 21:05:11 2013 +0200

    Connect watcher failure function to the failure signal

commit 49b9a1e8af062c03ebc863e1139ca310944b784a
Author: Bart Visscher <bartv@thisnet.nl>
Date:   Tue Apr 9 20:51:43 2013 +0200

    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

core/ajax/update.php
lib/base.php
lib/config.php
lib/connector/sabre/maintenanceplugin.php
lib/util.php

index d5588b7c85228c90ed0a19efba534c7c18a58ee2..0b1c9386282fcb938afd571dad81528c96015d41 100644 (file)
@@ -5,11 +5,15 @@ require_once '../../lib/base.php';
 
 if (OC::checkUpgrade(false)) {
        \OC_DB::enableCaching(false);
+       OC_Config::setValue('maintenance', true);
+       $installedVersion = OC_Config::getValue('version', '0.0.0');
+       $currentVersion = implode('.', OC_Util::getVersion());
+       OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::WARN);
        $updateEventSource = new OC_EventSource();
        $watcher = new UpdateWatcher($updateEventSource);
        OC_Hook::connect('update', 'success', $watcher, 'success');
        OC_Hook::connect('update', 'error', $watcher, 'error');
-       OC_Hook::connect('update', 'error', $watcher, 'failure');
+       OC_Hook::connect('update', 'failure', $watcher, 'failure');
        $watcher->success('Turned on maintenance mode');
        try {
                $result = OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
@@ -99,6 +103,7 @@ class UpdateWatcher {
                OC_Util::obEnd();
                $this->eventSource->send('failure', $message);
                $this->eventSource->close();
+               OC_Config::setValue('maintenance', false);
                die();
        }
 
index 6bdabc011f214fc9611d3ab48a83d4976ad92bad..b58ffb4dfbb6c8af73ba300511e48f346bc69fa1 100644 (file)
@@ -275,10 +275,7 @@ class OC {
                        $currentVersion = implode('.', OC_Util::getVersion());
                        if (version_compare($currentVersion, $installedVersion, '>')) {
                                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);
+                                       OC_Config::setValue('theme', '');
                                        $minimizerCSS = new OC_Minimizer_CSS();
                                        $minimizerCSS->clearCache();
                                        $minimizerJS = new OC_Minimizer_JS();
index 0bd497b8e50a396758f987ca44ecef66052fd948..4f216a2dfc3108cffcb551bd1bb31f89e5f0eb74 100644 (file)
@@ -173,7 +173,7 @@ class OC_Config{
                }
                // Prevent others not to read the config
                @chmod($filename, 0640);
-
+               OC_Util::clearOpcodeCache();
                return true;
        }
 }
index 329fa4443ad7076aabe5f0364fc605362ff26982..2eda269afc2c8c0c81c4467b43f6e4a35f199cc5 100644 (file)
@@ -50,6 +50,9 @@ class OC_Connector_Sabre_MaintenancePlugin extends Sabre_DAV_ServerPlugin
                if (OC_Config::getValue('maintenance', false)) {
                        throw new Sabre_DAV_Exception_ServiceUnavailable();
                }
+               if (OC::checkUpgrade(false)) {
+                       throw new Sabre_DAV_Exception_ServiceUnavailable('Upgrade needed');
+               }
 
                return true;
        }
index 7f5f30aa61958113e51b23d89470c0622d1f9d08..9d2038a26b17d5609e7edfbb0aac2c525317d199 100755 (executable)
@@ -825,5 +825,24 @@ class OC_Util {
                return $theme;
        }
 
+       /**
+        * Clear the opcode cache if one exists
+        * This is necessary for writing to the config file
+        * in case the opcode cache doesn't revalidate files
+        */
+       public static function clearOpcodeCache() {
+               // APC
+               if (function_exists('apc_clear_cache')) {
+                       apc_clear_cache();
+               }
+               // Zend Opcache
+               if (function_exists('accelerator_reset')) {
+                       accelerator_reset();
+               }
+               // XCache
+               if (function_exists('xcache_clear_cache')) {
+                       xcache_clear_cache(XC_TYPE_VAR, 0);
+               }
+       }
 
 }