diff options
author | VicDeo <dubiniuk@owncloud.com> | 2016-06-22 14:12:36 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-07-01 12:31:57 +0300 |
commit | 9fcb26910e98282459fc7bf291f0a21275a1c919 (patch) | |
tree | 951975b0d264fee77dc7154ac81c85162bb64d57 /lib | |
parent | 21bdd3005ba586e717b1c812ad1755eee06ff871 (diff) |
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')
-rw-r--r-- | lib/base.php | 19 | ||||
-rw-r--r-- | lib/private/console/application.php | 3 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/base.php b/lib/base.php index e77a07239c4..07d8f3b788b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -53,6 +53,8 @@ * */ +use OCP\IRequest; + require_once 'public/constants.php'; /** @@ -296,9 +298,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'); @@ -836,7 +849,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(); } diff --git a/lib/private/console/application.php b/lib/private/console/application.php index 7f12db4eca6..7a8ec49c65b 100644 --- a/lib/private/console/application.php +++ b/lib/private/console/application.php @@ -138,9 +138,10 @@ class Application { * @throws \Exception */ public function run(InputInterface $input = null, OutputInterface $output = null) { + $args = isset($this->request->server['argv']) ? $this->request->server['argv'] : []; $this->dispatcher->dispatch(ConsoleEvent::EVENT_RUN, new ConsoleEvent( ConsoleEvent::EVENT_RUN, - $this->request->server['argv'] + $args )); return $this->application->run($input, $output); } |