diff options
author | VicDeo <dubiniuk@owncloud.com> | 2016-06-22 14:12:36 +0300 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-06-22 13:12:36 +0200 |
commit | 854352d9a064a1e469ede207493bce44fd41d96c (patch) | |
tree | eb882140fe0ed3ac64014c8825fe52f8d375b2f4 /lib/base.php | |
parent | c49ff83f18dba22f4a2e04a4df3d1e6a6623a0f7 (diff) | |
download | nextcloud-server-854352d9a064a1e469ede207493bce44fd41d96c.tar.gz nextcloud-server-854352d9a064a1e469ede207493bce44fd41d96c.zip |
occ web executor (#24957)
* Initial web executor
* Fix PHPDoc
Fix broken integration test
OccControllerTests do not require database access - moch them all!
Kill unused sprintf
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 b33687dbab7..45f291e5cb7 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'); @@ -820,7 +833,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(); } |