Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183604
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 ApiGetDisplayTitle.php
1 file changed, 16 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VikiSemanticTitle
refs/changes/04/183604/1
diff --git a/ApiGetDisplayTitle.php b/ApiGetDisplayTitle.php
index 37937c0..9fbfdea 100644
--- a/ApiGetDisplayTitle.php
+++ b/ApiGetDisplayTitle.php
@@ -48,10 +48,17 @@
);
$api->execute();
- $data = $api->getResultData();
+ if ( defined( 'ApiResult::META_CONTENT' ) ) {
+ $data = array_values(
ApiResult::removeMetadataNonRecursive(
+ $api->getResult()->getResultData( array(
'query', 'pages' ) )
+ ) );
+ $namespace = $data[0]["ns"];
+ } else {
+ $data = $api->getResultData();
+ $key = array_shift( array_keys( $data["query"]["pages"]
) );
+ $namespace = $data["query"]["pages"][$key]["ns"];
+ }
- $key = array_shift( array_keys( $data["query"]["pages"] ) );
- $namespace = $data["query"]["pages"][$key]["ns"];
// If the namespace is in $wgSemanticTitleProperties, extract
the title property.
@@ -72,7 +79,11 @@
);
$api->execute();
- $data = $api->getResultData();
+ if ( defined( 'ApiResult::META_CONTENT' ) ) {
+ $data = $api->getResult()->getResultData();
+ } else {
+ $data = $api->getResultData();
+ }
$displayName =
$data["query"]["results"][$pageTitle]["printouts"][$displayNameProperty][0];
if ( $displayName == null )
@@ -112,4 +123,4 @@
public function getHelpUrls() {
return '';
}
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/183604
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VikiSemanticTitle
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits