aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-09-21 17:56:00 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-09-21 17:56:00 +0200
commit87e10f9e6a0907adf20538f09159274e6b9ca429 (patch)
tree821c99e73b518064dc1e8b966e31416babf80fcf
parent4d556a3ade39f38eb4b2ca3253863e3f86c7c69b (diff)
downloadnextcloud-server-87e10f9e6a0907adf20538f09159274e6b9ca429.tar.gz
nextcloud-server-87e10f9e6a0907adf20538f09159274e6b9ca429.zip
OC_OCS_Response is deprecated
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--apps/files_external/lib/Lib/Api.php4
-rw-r--r--lib/private/legacy/api.php14
-rw-r--r--lib/public/AppFramework/Http/OCSResponse.php2
-rw-r--r--ocs/v1.php8
-rw-r--r--tests/lib/APITest.php8
5 files changed, 18 insertions, 18 deletions
diff --git a/apps/files_external/lib/Lib/Api.php b/apps/files_external/lib/Lib/Api.php
index 6b10443bbdc..547285a2312 100644
--- a/apps/files_external/lib/Lib/Api.php
+++ b/apps/files_external/lib/Lib/Api.php
@@ -72,7 +72,7 @@ class Api {
* Returns the mount points visible for this user.
*
* @param array $params
- * @return \OC_OCS_Result share information
+ * @return \OC\OCS\Result share information
*/
public static function getUserMounts($params) {
$entries = array();
@@ -83,6 +83,6 @@ class Api {
$entries[] = self::formatMount($mountPoint, $mount);
}
- return new \OC_OCS_Result($entries);
+ return new \OC\OCS\Result($entries);
}
}
diff --git a/lib/private/legacy/api.php b/lib/private/legacy/api.php
index f65275bf1da..7fe84b73c43 100644
--- a/lib/private/legacy/api.php
+++ b/lib/private/legacy/api.php
@@ -129,7 +129,7 @@ class OC_API {
if(!self::isAuthorised($action)) {
$responses[] = array(
'app' => $action['app'],
- 'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
+ 'response' => new \OC\OCS\Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'),
'shipped' => $appManager->isShipped($action['app']),
);
continue;
@@ -137,7 +137,7 @@ class OC_API {
if(!is_callable($action['action'])) {
$responses[] = array(
'app' => $action['app'],
- 'response' => new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'),
+ 'response' => new \OC\OCS\Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'),
'shipped' => $appManager->isShipped($action['app']),
);
continue;
@@ -161,7 +161,7 @@ class OC_API {
/**
* merge the returned result objects into one response
* @param array $responses
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
public static function mergeResponses($responses) {
// Sort into shipped and third-party
@@ -205,7 +205,7 @@ class OC_API {
$code = $picked['response']->getStatusCode();
$meta = $picked['response']->getMeta();
$headers = $picked['response']->getHeaders();
- $response = new OC_OCS_Result($data, $code, $meta['message'], $headers);
+ $response = new \OC\OCS\Result($data, $code, $meta['message'], $headers);
return $response;
} elseif(!empty($shipped['succeeded'])) {
$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
@@ -219,7 +219,7 @@ class OC_API {
$code = $picked['response']->getStatusCode();
$meta = $picked['response']->getMeta();
$headers = $picked['response']->getHeaders();
- $response = new OC_OCS_Result($data, $code, $meta['message'], $headers);
+ $response = new \OC\OCS\Result($data, $code, $meta['message'], $headers);
return $response;
} else {
$responses = $thirdparty['succeeded'];
@@ -251,7 +251,7 @@ class OC_API {
}
}
- return new OC_OCS_Result($data, $statusCode, $statusMessage, $header);
+ return new \OC\OCS\Result($data, $statusCode, $statusMessage, $header);
}
/**
@@ -351,7 +351,7 @@ class OC_API {
/**
* respond to a call
- * @param OC_OCS_Result $result
+ * @param \OC\OCS\Result $result
* @param string $format the format xml|json
*/
public static function respond($result, $format='xml') {
diff --git a/lib/public/AppFramework/Http/OCSResponse.php b/lib/public/AppFramework/Http/OCSResponse.php
index 8614e76805f..ee1207f1217 100644
--- a/lib/public/AppFramework/Http/OCSResponse.php
+++ b/lib/public/AppFramework/Http/OCSResponse.php
@@ -83,7 +83,7 @@ class OCSResponse extends Response {
* @suppress PhanDeprecatedClass
*/
public function render() {
- $r = new \OC_OCS_Result($this->data, $this->statuscode, $this->message);
+ $r = new \OC\OCS\Result($this->data, $this->statuscode, $this->message);
$r->setTotalItems($this->itemscount);
$r->setItemsPerPage($this->itemsperpage);
diff --git a/ocs/v1.php b/ocs/v1.php
index 80df64f4ed6..857dc0fd148 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -36,7 +36,7 @@ if (\OCP\Util::needUpgrade()
// since the behavior of apps or remotes are unpredictable during
// an upgrade, return a 503 directly
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
- $response = new OC_OCS_Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
+ $response = new \OC\OCS\Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
OC_API::respond($response, OC_API::requestedFormat());
exit;
}
@@ -81,14 +81,14 @@ try {
$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. DEBUG OUTPUT:'."\n";
- OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
+ OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
} catch (MethodNotAllowedException $e) {
OC_API::setContentType();
OC_Response::setStatus(405);
} catch (\OC\OCS\Exception $ex) {
OC_API::respond($ex->getResult(), OC_API::requestedFormat());
} catch (\OC\User\LoginException $e) {
- OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
+ OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'));
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e);
OC_API::setContentType();
@@ -96,6 +96,6 @@ try {
$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. DEBUG OUTPUT:'."\n";
- OC_API::respond(new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
+ OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format);
}
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php
index d3ab6db9e4b..c2a25d1306c 100644
--- a/tests/lib/APITest.php
+++ b/tests/lib/APITest.php
@@ -16,7 +16,7 @@ class APITest extends \Test\TestCase {
* @param string $message
*/
function buildResponse($shipped, $data, $code, $message=null) {
- $resp = new \OC_OCS_Result($data, $code, $message);
+ $resp = new \OC\OCS\Result($data, $code, $message);
$resp->addHeader('KEY', 'VALUE');
return [
'shipped' => $shipped,
@@ -28,13 +28,13 @@ class APITest extends \Test\TestCase {
// Validate details of the result
/**
- * @param \OC_OCS_Result $result
+ * @param \OC\OCS\Result $result
*/
function checkResult($result, $success) {
// Check response is of correct type
- $this->assertInstanceOf('OC_OCS_Result', $result);
+ $this->assertInstanceOf(\OC\OCS\Result::class, $result);
// Check if it succeeded
- /** @var $result \OC_OCS_Result */
+ /** @var $result \OC\OCS\Result */
$this->assertEquals($success, $result->succeeded());
}