r112751 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112750‎ | r112751 | r112752 >
Date:01:17, 1 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Don't explicitly use Services_JSON, use FormatJson
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -239,19 +239,6 @@
240240 }
241241
242242 /**
243 - * @return Services_JSON
244 - */
245 - static function getJsonCodec() {
246 - static $json = null;
247 -
248 - if ( !$json ) {
249 - $json = new Services_JSON(); # recycle API's JSON codec implementation
250 - }
251 -
252 - return $json;
253 - }
254 -
255 - /**
256243 * @param $options
257244 * @param $enc
258245 * @return mixed
@@ -261,8 +248,7 @@
262249 if ( $enc == 'mode' || $enc == '' ) {
263250 $opt = $options['mode'];
264251 } elseif ( $enc == 'json' ) {
265 - $json = self::getJsonCodec(); // XXX: this may be a bit heavy...
266 - $opt = $json->encode( $options );
 252+ $opt = FormatJson::encode( $options );
267253 } else {
268254 throw new MWException( 'Unknown encoding for CategoryTree options: ' . $enc );
269255 }
@@ -280,8 +266,7 @@
281267 if ( $enc == 'mode' || $enc == '' ) {
282268 $opt = array( "mode" => $options );
283269 } elseif ( $enc == 'json' ) {
284 - $json = self::getJsonCodec(); // XXX: this may be a bit heavy...
285 - $opt = $json->decode( $options );
 270+ $opt = FormatJson::decode( $options );
286271 $opt = get_object_vars( $opt );
287272 } else {
288273 throw new MWException( 'Unknown encoding for CategoryTree options: ' . $enc );

Sign-offs

UserFlagDate
Nikerabbitinspected07:13, 1 March 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r112754MFT r112751...reedy01:21, 1 March 2012
r113035MFT r110933, r111011, r111218, r112751, r112925, r112993reedy14:31, 5 March 2012
r113037MFT r110703, r110933, r111011, r111218, r112520, r112524, r112660, r112687, r...reedy14:59, 5 March 2012

Status & tagging log