Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183592
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: I7b37295e8862b188d1f3b0cd07f66ac34629678d
---
M PGFTikZ.parser.php
1 file changed, 32 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PGFTikZ
refs/changes/92/183592/1
diff --git a/PGFTikZ.parser.php b/PGFTikZ.parser.php
index 7f8f05b..7b369bf 100644
--- a/PGFTikZ.parser.php
+++ b/PGFTikZ.parser.php
@@ -51,8 +51,14 @@
self::errorMsgLog( wfMessage(
'pgftikz-error-apigetpagecontent' ),
$e->getMessage() );
}
- $apiResult = $api->getResultData();
- $apiPagePreview = array_values( $apiResult['query']['pages'] );
+ if ( defined( 'ApiResult::META_CONTENT' ) ) {
+ $apiPagePreview = array_values(
ApiResult::removeMetadataNonRecursive(
+ (array)$api->getResult()->getResultData( array(
'query', 'pages' ) )
+ ) );
+ } else {
+ $apiResult = $api->getResultData();
+ $apiPagePreview = array_values(
$apiResult['query']['pages'] );
+ }
if ( count( $apiPagePreview ) > 0 ) {
$previewPageExists = array_key_exists( 'pageid',
@@ -225,8 +231,14 @@
wfMessage(
'pgftikz-error-apigetpagecontent' ),
$e->getMessage() );
}
- $apiResult = $api->getResultData();
- $apiPagesResult = array_values(
$apiResult['query']['pages'] );
+ if ( defined( 'ApiResult::META_CONTENT' ) ) {
+ $apiPagesResult = array_values(
ApiResult::removeMetadataNonRecursive(
+
(array)$api->getResult()->getResultData( array( 'query', 'pages' ) )
+ ) );
+ } else {
+ $apiResult = $api->getResultData();
+ $apiPagesResult = array_values(
$apiResult['query']['pages'] );
+ }
if ( count( $apiPagesResult ) > 0 ) {
$flagFoundImage = array_key_exists( 'revisions',
@@ -237,10 +249,18 @@
wfDebugLog( "", "PGF-File
$imgFname already exists, " .
"checking if
different\n". "\n");
}
- if ( count(
$apiPagesResult[0]['revisions'] ) > 0 ) {
+ $revisions =
ApiResult::removeMetadataNonRecursive(
+ $apiPagesResult[0]['revisions']
+ );
+ if ( count( $revisions ) > 0 ) {
// File already exists, compare
content
- $imgPageTextRef =
-
$apiPagesResult[0]['revisions'][0]['*'];
+ if ( defined(
'ApiResult::META_CONTENT' ) &&
+ isset(
$revisions[0][ApiResult::META_CONTENT] )
+ ) {
+ $imgPageTextRef =
$revisions[0][$revisions[0][ApiResult::META_CONTENT]];
+ } else {
+ $imgPageTextRef =
$revisions[0]['*'];
+ }
$textNewArray = explode(
PHP_EOL, $imgPageText );
$textRefArray = explode(
PHP_EOL, $imgPageTextRef );
$nLinesNew = count(
$textNewArray );
@@ -482,7 +502,11 @@
self::errorMsgLog( wfMessage(
'pgftikz-error-apiedit' ),
$e->getMessage() );
}
- $apiResult = $api->getResultData();
+ if ( defined( 'ApiResult::META_CONTENT' ) ) {
+ $apiResult = $api->getResult()->getResultData();
+ } else {
+ $apiResult = $api->getResultData();
+ }
if ( array_key_exists ( 'edit', $apiResult ) ) {
if ( array_key_exists( 'result',
$apiResult['edit'] ) ) {
if ( !strcasecmp(
$apiResult['edit']['result'],
--
To view, visit https://gerrit.wikimedia.org/r/183592
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PGFTikZ
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits