Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183599

Change subject: Update ApiResult handling for mediawiki/core change I7b37295e
......................................................................

Update ApiResult handling for mediawiki/core change I7b37295e

Change I7b37295e for mediawiki/core deprecates several methods, and more
importantly changes the format of the data returned from
ApiResult::getData(). This change should handle these differences in a
backwards-compatible manner.

Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e
---
M ApiQueryVideoInfo.php
M handlers/TextHandler/TextHandler.php
2 files changed, 19 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/99/183599/1

diff --git a/ApiQueryVideoInfo.php b/ApiQueryVideoInfo.php
index d4f0b88..731a8aa 100644
--- a/ApiQueryVideoInfo.php
+++ b/ApiQueryVideoInfo.php
@@ -204,8 +204,15 @@
                                $skip = false;
                        }
 
-                       $data = $this->getResultData();
-                       foreach ( $data['query']['pages'] as $pageid => $arr ) {
+                       if ( defined( 'ApiResult::META_CONTENT' ) ) {
+                               $pages = ApiResult::removeMetadataNonRecursive(
+                                       
(array)$this->getResult()->getResultData( array( 'query', 'pages' ) )
+                               );
+                       } else {
+                               $data = $this->getResultData();
+                               $pages = $data['query']['pages'];
+                       }
+                       foreach ( $pages as $pageid => $arr ) {
                                if ( !isset( $arr['imagerepository'] ) ) {
                                        $result->addValue(
                                                array( 'query', 'pages', 
$pageid ),
diff --git a/handlers/TextHandler/TextHandler.php 
b/handlers/TextHandler/TextHandler.php
index 87c9c63..ec1d8b2 100644
--- a/handlers/TextHandler/TextHandler.php
+++ b/handlers/TextHandler/TextHandler.php
@@ -186,7 +186,11 @@
                        $params = new FauxRequest( $this->getTextPagesQuery() );
                        $api = new ApiMain( $params );
                        $api->execute();
-                       $data = $api->getResultData();
+                       if ( defined( 'ApiResult::META_CONTENT' ) ) {
+                               $data = ApiResult::removeMetadata( 
$api->getResult()->getResultData() );
+                       } else {
+                               $data = $api->getResultData();
+                       }
                        wfDebug(print_r($data, true));
                        // Get the list of language Names
                        return $this->getTextTracksFromData( $data );
@@ -212,7 +216,11 @@
                $query->profileOut();
                $api->profileOut();
 
-               $data = $module->getResultData();
+               if ( defined( 'ApiResult::META_CONTENT' ) ) {
+                       $data = ApiResult::removeMetadata( 
$module->getResult()->getResultData() );
+               } else {
+                       $data = $module->getResultData();
+               }
                // Get the list of language Names
                return $this->getTextTracksFromData( $data );
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

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

Reply via email to