Skip to content

Commit fae5b1b

Browse files
committed
Remove unused methods of OC_Json
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
1 parent 3655951 commit fae5b1b

3 files changed

Lines changed: 6 additions & 64 deletions

File tree

lib/private/legacy/eventsource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ public function send($type, $data = null) {
110110
}
111111
if ($this->fallback) {
112112
$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
113-
. $this->fallBackId . ',"' . $type . '",' . OCP\JSON::encode($data) . ')</script>' . PHP_EOL;
113+
. $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
114114
echo $response;
115115
} else {
116116
if ($type) {
117117
echo 'event: ' . $type . PHP_EOL;
118118
}
119-
echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL;
119+
echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
120120
}
121121
echo PHP_EOL;
122122
flush();

lib/private/legacy/json.php

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,6 @@ public static function checkAdminUser() {
111111
}
112112
}
113113

114-
/**
115-
* Check is a given user exists - send json error msg if not
116-
* @param string $user
117-
* @deprecated Use a AppFramework JSONResponse instead
118-
* @suppress PhanDeprecatedFunction
119-
*/
120-
public static function checkUserExists($user) {
121-
if (!\OC::$server->getUserManager()->userExists($user)) {
122-
$l = \OC::$server->getL10N('lib');
123-
OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' )));
124-
exit;
125-
}
126-
}
127-
128-
129114
/**
130115
* Check if the user is a subadmin, send json error msg if not
131116
* @deprecated Use annotation based ACLs from the AppFramework instead
@@ -152,7 +137,8 @@ public static function checkSubAdminUser() {
152137
*/
153138
public static function error($data = array()) {
154139
$data['status'] = 'error';
155-
self::encodedPrint($data);
140+
self::setContentTypeHeader();
141+
echo self::encode($data);
156142
}
157143

158144
/**
@@ -162,7 +148,8 @@ public static function error($data = array()) {
162148
*/
163149
public static function success($data = array()) {
164150
$data['status'] = 'success';
165-
self::encodedPrint($data);
151+
self::setContentTypeHeader();
152+
echo self::encode($data);
166153
}
167154

168155
/**
@@ -174,18 +161,6 @@ protected static function to_string(&$value) {
174161
}
175162
}
176163

177-
/**
178-
* Encode and print $data in json format
179-
* @deprecated Use a AppFramework JSONResponse instead
180-
* @suppress PhanDeprecatedFunction
181-
*/
182-
public static function encodedPrint($data, $setContentType=true) {
183-
if($setContentType) {
184-
self::setContentTypeHeader();
185-
}
186-
echo self::encode($data);
187-
}
188-
189164
/**
190165
* Encode JSON
191166
* @deprecated Use a AppFramework JSONResponse instead

lib/public/JSON.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@
4141
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead
4242
*/
4343
class JSON {
44-
/**
45-
* Encode and print $data in JSON format
46-
* @param array $data The data to use
47-
* @param bool $setContentType the optional content type
48-
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead
49-
*
50-
* @suppress PhanDeprecatedFunction
51-
*/
52-
public static function encodedPrint( $data, $setContentType=true ) {
53-
\OC_JSON::encodedPrint($data, $setContentType);
54-
}
55-
5644
/**
5745
* Check if the user is logged in, send json error msg if not.
5846
*
@@ -185,25 +173,4 @@ public static function checkAppEnabled( $app ) {
185173
public static function checkAdminUser() {
186174
\OC_JSON::checkAdminUser();
187175
}
188-
189-
/**
190-
* Encode JSON
191-
* @param array $data
192-
* @return string
193-
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead
194-
* @suppress PhanDeprecatedFunction
195-
*/
196-
public static function encode($data) {
197-
return \OC_JSON::encode($data);
198-
}
199-
200-
/**
201-
* Check is a given user exists - send json error msg if not
202-
* @param string $user
203-
* @deprecated 8.1.0 Use a AppFramework JSONResponse instead
204-
* @suppress PhanDeprecatedFunction
205-
*/
206-
public static function checkUserExists($user) {
207-
\OC_JSON::checkUserExists($user);
208-
}
209176
}

0 commit comments

Comments
 (0)