Adamw has submitted this change and it was merged.

Change subject: Remove dependency on Services_JSON class
......................................................................


Remove dependency on Services_JSON class

This prepares us for removing the class from core.

Change-Id: I717c464ee494a80b6360290993bf3e8f108f1fe6
---
M Collection.body.php
M Collection.php
2 files changed, 4 insertions(+), 8 deletions(-)

Approvals:
  Adamw: Verified; Looks good to me, approved



diff --git a/Collection.body.php b/Collection.body.php
index db6b037..8c67526 100644
--- a/Collection.body.php
+++ b/Collection.body.php
@@ -1044,8 +1044,7 @@
                }
                $result['items'] = $items;
 
-               $json = new Services_JSON();
-               return $json->encode( $result );
+               return FormatJson::encode( $result );
        }
 
        /**
@@ -1363,8 +1362,7 @@
                        return false;
                }
 
-               $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE );
-               $json_response = $json->decode( $response );
+               $json_response = FormatJson::decode( $response, true );
 
                if ( !$json_response ) {
                        $wgOut->showErrorPage(
diff --git a/Collection.php b/Collection.php
index 41d2bfb..7292604 100644
--- a/Collection.php
+++ b/Collection.php
@@ -214,11 +214,10 @@
 $wgAjaxExportList[] = 'wfAjaxGetCollection';
 
 function wfAjaxPostCollection( $collection = '', $redirect = '' ) {
-       $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE );
        if ( session_id() == '' ) {
                wfSetupSession();
        }
-       $collection = $json->decode( $collection );
+       $collection = FormatJson::decode( $collection, true );
        $collection['enabled'] = true;
        $_SESSION['wsCollection'] = $collection;
        $r = new AjaxResponse();
@@ -449,9 +448,8 @@
 $wgAjaxExportList[] = 'wfAjaxCollectionSuggestRemoveArticle';
 
 function wfAjaxCollectionSuggestUndoArticle( $lastAction, $article ) {
-       $json = new Services_JSON();
        $result = CollectionSuggest::undo( $lastAction, $article );
-       $r = new AjaxResponse( $json->encode( $result ) );
+       $r = new AjaxResponse( FormatJson::encode( $result ) );
        $r->setContentType( 'application/json' );
        return $r;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/49602
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I717c464ee494a80b6360290993bf3e8f108f1fe6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: PleaseStand <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: schmir <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to