Suppress deprecated function in \OCP\JSON

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-07-19 15:50:59 +02:00 committed by Roeland Jago Douma
parent 5424d6a40d
commit 80b649c471
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 16 additions and 5 deletions

View File

@ -45,6 +45,8 @@ class JSON {
* @param array $data The data to use * @param array $data The data to use
* @param bool $setContentType the optional content type * @param bool $setContentType the optional content type
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
*
* @suppress PhanDeprecatedFunction
*/ */
public static function encodedPrint( $data, $setContentType=true ) { public static function encodedPrint( $data, $setContentType=true ) {
\OC_JSON::encodedPrint($data, $setContentType); \OC_JSON::encodedPrint($data, $setContentType);
@ -63,6 +65,8 @@ class JSON {
* Add this call to the start of all ajax method files that requires * Add this call to the start of all ajax method files that requires
* an authenticated user. * an authenticated user.
* @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead
*
* @suppress PhanDeprecatedFunction
*/ */
public static function checkLoggedIn() { public static function checkLoggedIn() {
\OC_JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
@ -86,6 +90,8 @@ class JSON {
* parameter to the ajax call, then assign it to the template and finally * parameter to the ajax call, then assign it to the template and finally
* add a hidden input field also named 'requesttoken' containing the value. * add a hidden input field also named 'requesttoken' containing the value.
* @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead * @deprecated 8.1.0 Use annotation based CSRF checks from the AppFramework instead
*
* @suppress PhanDeprecatedFunction
*/ */
public static function callCheck() { public static function callCheck() {
\OC_JSON::callCheck(); \OC_JSON::callCheck();
@ -98,8 +104,8 @@ class JSON {
* @see \OCP\JSON::error() for the format to use. * @see \OCP\JSON::error() for the format to use.
* *
* @param array $data The data to use * @param array $data The data to use
* @return string json formatted string.
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/ */
public static function success( $data = array() ) { public static function success( $data = array() ) {
\OC_JSON::success($data); \OC_JSON::success($data);
@ -121,17 +127,18 @@ class JSON {
* {"status":"error","data":{"message":"An error happened", "id":[some value]}} * {"status":"error","data":{"message":"An error happened", "id":[some value]}}
* *
* @param array $data The data to use * @param array $data The data to use
* @return string json formatted error string.
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/ */
public static function error( $data = array() ) { public static function error( $data = array() ) {
\OC_JSON::error( $data ); \OC_JSON::error($data);
} }
/** /**
* Set Content-Type header to jsonrequest * Set Content-Type header to jsonrequest
* @param string $type The content type header * @param string $type The content type header
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/ */
public static function setContentTypeHeader( $type='application/json' ) { public static function setContentTypeHeader( $type='application/json' ) {
\OC_JSON::setContentTypeHeader($type); \OC_JSON::setContentTypeHeader($type);
@ -152,6 +159,7 @@ class JSON {
* *
* @param string $app The app to check * @param string $app The app to check
* @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled. * @deprecated 8.1.0 Use the AppFramework instead. It will automatically check if the app is enabled.
* @suppress PhanDeprecatedFunction
*/ */
public static function checkAppEnabled( $app ) { public static function checkAppEnabled( $app ) {
\OC_JSON::checkAppEnabled($app); \OC_JSON::checkAppEnabled($app);
@ -171,6 +179,7 @@ class JSON {
* administrative rights. * administrative rights.
* *
* @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead * @deprecated 8.1.0 Use annotation based ACLs from the AppFramework instead
* @suppress PhanDeprecatedFunction
*/ */
public static function checkAdminUser() { public static function checkAdminUser() {
\OC_JSON::checkAdminUser(); \OC_JSON::checkAdminUser();
@ -181,6 +190,7 @@ class JSON {
* @param array $data * @param array $data
* @return string * @return string
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/ */
public static function encode($data) { public static function encode($data) {
return \OC_JSON::encode($data); return \OC_JSON::encode($data);
@ -190,6 +200,7 @@ class JSON {
* Check is a given user exists - send json error msg if not * Check is a given user exists - send json error msg if not
* @param string $user * @param string $user
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead * @deprecated 8.1.0 Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/ */
public static function checkUserExists($user) { public static function checkUserExists($user) {
\OC_JSON::checkUserExists($user); \OC_JSON::checkUserExists($user);

View File

@ -34,7 +34,7 @@ $url = $request->getServerProtocol() . '://' . substr($request->getServerHost()
$writer = new XMLWriter(); $writer = new XMLWriter();
$writer->openURI('php://output'); $writer->openURI('php://output');
$writer->startDocument('1.0','UTF-8'); $writer->startDocument('1.0','UTF-8');
$writer->setIndent(4); $writer->setIndent(true);
$writer->startElement('providers'); $writer->startElement('providers');
$writer->startElement('provider'); $writer->startElement('provider');
$writer->writeElement('id', 'ownCloud'); $writer->writeElement('id', 'ownCloud');

View File

@ -41,7 +41,7 @@ class RemoteException extends Exception {
} }
/** /**
* @param Exception | Error $e * @param Exception|Error $e
*/ */
function handleException($e) { function handleException($e) {
$request = \OC::$server->getRequest(); $request = \OC::$server->getRequest();