summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-10 18:01:07 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-18 11:10:07 +0200
commit799205488cf82312586f99185e13df6015caa2ff (patch)
treed8c6172b48d8cdabb16ef8b535a21c96b1ebc739 /lib/private
parentbaf46c74cda834bbdb4ecf4669587b92b56fe9a9 (diff)
downloadnextcloud-server-799205488cf82312586f99185e13df6015caa2ff.tar.gz
nextcloud-server-799205488cf82312586f99185e13df6015caa2ff.zip
Prevent loadApps on upgrade
Moved OC::needUpgrade() to OCP\Util::needUpgrade() to make it accessible form the router. Moved maintenance + upgrade check to the router.
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/route/router.php4
-rwxr-xr-xlib/private/util.php17
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/private/route/router.php b/lib/private/route/router.php
index e7c8ad9ebdd..f3a4bc5f3e4 100644
--- a/lib/private/route/router.php
+++ b/lib/private/route/router.php
@@ -192,7 +192,9 @@ class Router implements IRouter {
$this->loadRoutes($app);
} else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 10) === '/settings/') {
\OC::$REQUESTEDAPP = $url;
- \OC_App::loadApps();
+ if (!\OC_Config::getValue('maintenance', false) && !\OCP\Util::needUpgrade()) {
+ \OC_App::loadApps();
+ }
$this->loadRoutes('core');
} else {
$this->loadRoutes();
diff --git a/lib/private/util.php b/lib/private/util.php
index dfdddd0e3ab..94005daef61 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -329,7 +329,7 @@ class OC_Util {
$errors = array();
$CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
- if (!\OC::needUpgrade() && OC_Config::getValue('installed', false)) {
+ if (!self::needUpgrade() && OC_Config::getValue('installed', false)) {
// this check needs to be done every time
$errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
}
@@ -1356,4 +1356,19 @@ class OC_Util {
}
return true;
}
+
+ /**
+ * Check whether the instance needs to preform an upgrade
+ *
+ * @return bool
+ */
+ public static function needUpgrade() {
+ if (OC_Config::getValue('installed', false)) {
+ $installedVersion = OC_Config::getValue('version', '0.0.0');
+ $currentVersion = implode('.', OC_Util::getVersion());
+ return version_compare($currentVersion, $installedVersion, '>');
+ } else {
+ return false;
+ }
+ }
}