diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-26 12:55:05 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-26 12:55:05 +0200 |
commit | 7a9d60d87eb8e4414e5fe05830b088d426ff810d (patch) | |
tree | 0fc97a7eacfd071475afd8bc6d4372babacb5740 /lib/base.php | |
parent | 5387b942c44e05b87ba2a0fd54168f5278a31344 (diff) | |
parent | 52eab2a61a5d27b64fcd0440b91f854c052933a9 (diff) | |
download | nextcloud-server-7a9d60d87eb8e4414e5fe05830b088d426ff810d.tar.gz nextcloud-server-7a9d60d87eb8e4414e5fe05830b088d426ff810d.zip |
Merge remote-tracking branch 'upstream/master' into master-upstream-sync
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php index a2630093c94..9e5304b1634 100644 --- a/lib/base.php +++ b/lib/base.php @@ -49,6 +49,8 @@ * */ +use OCP\IRequest; + require_once 'public/Constants.php'; /** @@ -271,9 +273,20 @@ class OC { } } - public static function checkMaintenanceMode() { + /** + * Limit maintenance mode access + * @param IRequest $request + */ + public static function checkMaintenanceMode(IRequest $request) { + // Check if requested URL matches 'index.php/occ' + $isOccControllerRequested = preg_match('|/index\.php$|', $request->getScriptName()) === 1 + && strpos($request->getPathInfo(), '/occ/') === 0; // Allow ajax update script to execute without being stopped - if (\OC::$server->getSystemConfig()->getValue('maintenance', false) && OC::$SUBURI != '/core/ajax/update.php') { + if ( + \OC::$server->getSystemConfig()->getValue('maintenance', false) + && OC::$SUBURI != '/core/ajax/update.php' + && !$isOccControllerRequested + ) { // send http status 503 header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); @@ -822,7 +835,7 @@ class OC { $request = \OC::$server->getRequest(); $requestPath = $request->getRawPathInfo(); if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade - self::checkMaintenanceMode(); + self::checkMaintenanceMode($request); self::checkUpgrade(); } |