@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | require_once __DIR__ . '/../lib/base.php'; |
34 | 34 | |
35 | 35 | if (\OCP\Util::needUpgrade() |
36 | - || \OC::$server->getConfig()->getSystemValueBool('maintenance')) { |
|
37 | - // since the behavior of apps or remotes are unpredictable during |
|
38 | - // an upgrade, return a 503 directly |
|
39 | - http_response_code(503); |
|
40 | - $response = new \OC\OCS\Result(null, 503, 'Service unavailable'); |
|
41 | - OC_API::respond($response, OC_API::requestedFormat()); |
|
42 | - exit; |
|
36 | + || \OC::$server->getConfig()->getSystemValueBool('maintenance')) { |
|
37 | + // since the behavior of apps or remotes are unpredictable during |
|
38 | + // an upgrade, return a 503 directly |
|
39 | + http_response_code(503); |
|
40 | + $response = new \OC\OCS\Result(null, 503, 'Service unavailable'); |
|
41 | + OC_API::respond($response, OC_API::requestedFormat()); |
|
42 | + exit; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | use Symfony\Component\Routing\Exception\ResourceNotFoundException; |
@@ -49,39 +49,39 @@ discard block |
||
49 | 49 | * Try the appframework routes |
50 | 50 | */ |
51 | 51 | try { |
52 | - OC_App::loadApps(['session']); |
|
53 | - OC_App::loadApps(['authentication']); |
|
52 | + OC_App::loadApps(['session']); |
|
53 | + OC_App::loadApps(['authentication']); |
|
54 | 54 | |
55 | - // load all apps to get all api routes properly setup |
|
56 | - // FIXME: this should ideally appear after handleLogin but will cause |
|
57 | - // side effects in existing apps |
|
58 | - OC_App::loadApps(); |
|
55 | + // load all apps to get all api routes properly setup |
|
56 | + // FIXME: this should ideally appear after handleLogin but will cause |
|
57 | + // side effects in existing apps |
|
58 | + OC_App::loadApps(); |
|
59 | 59 | |
60 | - if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
61 | - OC::handleLogin(\OC::$server->getRequest()); |
|
62 | - } |
|
60 | + if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
61 | + OC::handleLogin(\OC::$server->getRequest()); |
|
62 | + } |
|
63 | 63 | |
64 | - OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
64 | + OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
65 | 65 | } catch (ResourceNotFoundException $e) { |
66 | - OC_API::setContentType(); |
|
66 | + OC_API::setContentType(); |
|
67 | 67 | |
68 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
69 | - $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
70 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
71 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
68 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
69 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
70 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
71 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
72 | 72 | } catch (MethodNotAllowedException $e) { |
73 | - OC_API::setContentType(); |
|
74 | - http_response_code(405); |
|
73 | + OC_API::setContentType(); |
|
74 | + http_response_code(405); |
|
75 | 75 | } catch (\OC\OCS\Exception $ex) { |
76 | - OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
76 | + OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
77 | 77 | } catch (\OC\User\LoginException $e) { |
78 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
78 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
79 | 79 | } catch (\Exception $e) { |
80 | - \OC::$server->getLogger()->logException($e); |
|
81 | - OC_API::setContentType(); |
|
80 | + \OC::$server->getLogger()->logException($e); |
|
81 | + OC_API::setContentType(); |
|
82 | 82 | |
83 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
84 | - $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
85 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
86 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
83 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
84 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
85 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
86 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
87 | 87 | } |