aboutsummaryrefslogtreecommitdiffstats
path: root/ocs
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-09-02 17:06:20 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-09-09 10:46:29 +0200
commitea32d17d88b52a07e04bbc2f8ea0e8d81e84b884 (patch)
tree4bf812075612c5b202fee1dbf66e8fbb628e1d30 /ocs
parent1fa674d907e211e1fac12e407e844b2a24f0bc0e (diff)
downloadnextcloud-server-ea32d17d88b52a07e04bbc2f8ea0e8d81e84b884.tar.gz
nextcloud-server-ea32d17d88b52a07e04bbc2f8ea0e8d81e84b884.zip
fix: Move OC_API into \OC\ApiHelper in standard namespace
It’s only used by ocs/v1.php Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'ocs')
-rw-r--r--ocs/v1.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/ocs/v1.php b/ocs/v1.php
index 91f52a66943..3f5ca621ab1 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -7,6 +7,8 @@
require_once __DIR__ . '/../lib/versioncheck.php';
require_once __DIR__ . '/../lib/base.php';
+use OC\AppFramework\OCS\ApiHelper;
+
if (\OCP\Util::needUpgrade()
|| \OC::$server->getConfig()->getSystemValueBool('maintenance')) {
// since the behavior of apps or remotes are unpredictable during
@@ -14,7 +16,7 @@ if (\OCP\Util::needUpgrade()
http_response_code(503);
header('X-Nextcloud-Maintenance-Mode: 1');
$response = new \OC\OCS\Result(null, 503, 'Service unavailable');
- OC_API::respond($response, OC_API::requestedFormat());
+ ApiHelper::respond($response, ApiHelper::requestedFormat());
exit;
}
@@ -43,24 +45,24 @@ try {
OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
} catch (MaxDelayReached $ex) {
$format = \OC::$server->getRequest()->getParam('format', 'xml');
- OC_API::respond(new \OC\OCS\Result(null, OCP\AppFramework\Http::STATUS_TOO_MANY_REQUESTS, $ex->getMessage()), $format);
+ ApiHelper::respond(new \OC\OCS\Result(null, OCP\AppFramework\Http::STATUS_TOO_MANY_REQUESTS, $ex->getMessage()), $format);
} catch (ResourceNotFoundException $e) {
- OC_API::setContentType();
+ ApiHelper::setContentType();
$format = \OC::$server->getRequest()->getParam('format', 'xml');
$txt = 'Invalid query, please check the syntax. API specifications are here:'
.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
- OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_NOT_FOUND, $txt), $format);
+ ApiHelper::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_NOT_FOUND, $txt), $format);
} catch (MethodNotAllowedException $e) {
- OC_API::setContentType();
+ ApiHelper::setContentType();
http_response_code(405);
} catch (\OC\OCS\Exception $ex) {
- OC_API::respond($ex->getResult(), OC_API::requestedFormat());
+ ApiHelper::respond($ex->getResult(), ApiHelper::requestedFormat());
} catch (\OC\User\LoginException $e) {
- OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_UNAUTHORISED, 'Unauthorised'));
+ ApiHelper::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_UNAUTHORISED, 'Unauthorised'));
} catch (\Exception $e) {
\OCP\Server::get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
- OC_API::setContentType();
+ ApiHelper::setContentType();
$format = \OC::$server->getRequest()->getParam('format', 'xml');
$txt = 'Internal Server Error'."\n";
@@ -71,5 +73,5 @@ try {
} catch (\Throwable $e) {
// Just to be save
}
- OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_SERVER_ERROR, $txt), $format);
+ ApiHelper::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_SERVER_ERROR, $txt), $format);
}