Completed
Push — master ( d42725...f39f95 )
by Morris
18:17
created
ocs/v1.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 require_once __DIR__ . '/../lib/base.php';
34 34
 
35 35
 if (\OCP\Util::needUpgrade()
36
-	|| \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
37
-	// since the behavior of apps or remotes are unpredictable during
38
-	// an upgrade, return a 503 directly
39
-	OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
40
-	$response = new \OC\OCS\Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
41
-	OC_API::respond($response, OC_API::requestedFormat());
42
-	exit;
36
+    || \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
37
+    // since the behavior of apps or remotes are unpredictable during
38
+    // an upgrade, return a 503 directly
39
+    OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
40
+    $response = new \OC\OCS\Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
41
+    OC_API::respond($response, OC_API::requestedFormat());
42
+    exit;
43 43
 }
44 44
 
45 45
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -50,57 +50,57 @@  discard block
 block discarded – undo
50 50
  * We first try the old routes since the appframework triggers more login stuff.
51 51
  */
52 52
 try {
53
-	OC_App::loadApps(['session']);
54
-	OC_App::loadApps(['authentication']);
55
-	// load all apps to get all api routes properly setup
56
-	OC_App::loadApps();
53
+    OC_App::loadApps(['session']);
54
+    OC_App::loadApps(['authentication']);
55
+    // load all apps to get all api routes properly setup
56
+    OC_App::loadApps();
57 57
 
58
-	OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo());
58
+    OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo());
59 59
 
60
-	sleep(1);
61
-	OC::$server->getLogger()->info('This uses an old OCP\API::register construct. This will be removed in a future version of Nextcloud. Please migrate to the OCSController');
60
+    sleep(1);
61
+    OC::$server->getLogger()->info('This uses an old OCP\API::register construct. This will be removed in a future version of Nextcloud. Please migrate to the OCSController');
62 62
 
63
-	return;
63
+    return;
64 64
 } catch (ResourceNotFoundException $e) {
65
-	// Fall through the not found
65
+    // Fall through the not found
66 66
 } catch (MethodNotAllowedException $e) {
67
-	OC_API::setContentType();
68
-	OC_Response::setStatus(405);
69
-	exit();
67
+    OC_API::setContentType();
68
+    OC_Response::setStatus(405);
69
+    exit();
70 70
 } catch (Exception $ex) {
71
-	OC_API::respond($ex->getResult(), OC_API::requestedFormat());
72
-	exit();
71
+    OC_API::respond($ex->getResult(), OC_API::requestedFormat());
72
+    exit();
73 73
 }
74 74
 
75 75
 /*
76 76
  * Try the appframework routes
77 77
  */
78 78
 try {
79
-	if(!\OC::$server->getUserSession()->isLoggedIn()) {
80
-		OC::handleLogin(\OC::$server->getRequest());
81
-	}
82
-	OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
79
+    if(!\OC::$server->getUserSession()->isLoggedIn()) {
80
+        OC::handleLogin(\OC::$server->getRequest());
81
+    }
82
+    OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
83 83
 } catch (ResourceNotFoundException $e) {
84
-	OC_API::setContentType();
84
+    OC_API::setContentType();
85 85
 
86
-	$format = \OC::$server->getRequest()->getParam('format', 'xml');
87
-	$txt='Invalid query, please check the syntax. API specifications are here:'
88
-		.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
89
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
86
+    $format = \OC::$server->getRequest()->getParam('format', 'xml');
87
+    $txt='Invalid query, please check the syntax. API specifications are here:'
88
+        .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
89
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
90 90
 } catch (MethodNotAllowedException $e) {
91
-	OC_API::setContentType();
92
-	OC_Response::setStatus(405);
91
+    OC_API::setContentType();
92
+    OC_Response::setStatus(405);
93 93
 } catch (\OC\OCS\Exception $ex) {
94
-	OC_API::respond($ex->getResult(), OC_API::requestedFormat());
94
+    OC_API::respond($ex->getResult(), OC_API::requestedFormat());
95 95
 } catch (\OC\User\LoginException $e) {
96
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
96
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
97 97
 } catch (\Exception $e) {
98
-	\OC::$server->getLogger()->logException($e);
99
-	OC_API::setContentType();
98
+    \OC::$server->getLogger()->logException($e);
99
+    OC_API::setContentType();
100 100
 
101
-	$format = \OC::$server->getRequest()->getParam('format', 'xml');
102
-	$txt='Invalid query, please check the syntax. API specifications are here:'
103
-		.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
104
-	OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
101
+    $format = \OC::$server->getRequest()->getParam('format', 'xml');
102
+    $txt='Invalid query, please check the syntax. API specifications are here:'
103
+        .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
104
+    OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
105 105
 }
106 106
 
Please login to merge, or discard this patch.