@@ -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,36 +49,36 @@ discard block |
||
49 | 49 | * Try the appframework routes |
50 | 50 | */ |
51 | 51 | try { |
52 | - OC_App::loadApps(['session']); |
|
53 | - OC_App::loadApps(['authentication']); |
|
54 | - if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
55 | - OC::handleLogin(\OC::$server->getRequest()); |
|
56 | - } |
|
52 | + OC_App::loadApps(['session']); |
|
53 | + OC_App::loadApps(['authentication']); |
|
54 | + if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
55 | + OC::handleLogin(\OC::$server->getRequest()); |
|
56 | + } |
|
57 | 57 | |
58 | - // load all apps to get all api routes properly setup |
|
59 | - OC_App::loadApps(); |
|
58 | + // load all apps to get all api routes properly setup |
|
59 | + OC_App::loadApps(); |
|
60 | 60 | |
61 | - OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
61 | + OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
|
62 | 62 | } catch (ResourceNotFoundException $e) { |
63 | - OC_API::setContentType(); |
|
63 | + OC_API::setContentType(); |
|
64 | 64 | |
65 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
66 | - $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
67 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
68 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
65 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
66 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
67 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
68 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
69 | 69 | } catch (MethodNotAllowedException $e) { |
70 | - OC_API::setContentType(); |
|
71 | - http_response_code(405); |
|
70 | + OC_API::setContentType(); |
|
71 | + http_response_code(405); |
|
72 | 72 | } catch (\OC\OCS\Exception $ex) { |
73 | - OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
73 | + OC_API::respond($ex->getResult(), OC_API::requestedFormat()); |
|
74 | 74 | } catch (\OC\User\LoginException $e) { |
75 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
75 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised')); |
|
76 | 76 | } catch (\Exception $e) { |
77 | - \OC::$server->getLogger()->logException($e); |
|
78 | - OC_API::setContentType(); |
|
77 | + \OC::$server->getLogger()->logException($e); |
|
78 | + OC_API::setContentType(); |
|
79 | 79 | |
80 | - $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
81 | - $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
82 | - .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
83 | - OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
80 | + $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
|
81 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
82 | + .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
|
83 | + OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
|
84 | 84 | } |