Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/182081
Change subject: API: Improve handling of interwiki redirects when resolving
......................................................................
API: Improve handling of interwiki redirects when resolving
When ApiPageSet resolves redirects, it should add the targets of any
interwiki redirects to its list of interwiki titles.
Also, when outputting the list of redirects it may as well include a
'tointerwiki' property to match the 'tofragment' property it already
outputs.
Bug: T85417
Change-Id: Icf1346f52c8efa099b502433de1b18c4caad09df
---
M RELEASE-NOTES-1.25
M includes/api/ApiPageSet.php
2 files changed, 10 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/81/182081/1
diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 77dc55b..5e8c5e4 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -161,6 +161,10 @@
* (T76052) list=tags can now indicate whether a tag is defined.
* (T75522) list=prefixsearch now supports continuation
* (T78737) action=expandtemplates can now return page properties.
+* (T85417) When resolving redirects, ApiPageSet will now add the targets of
+ interwiki redirects to the list of interwiki titles.
+* (T85417) When outputting the list of redirect titles, a 'tointerwiki'
+ property (like the existing 'tofragment' property) will be set.
=== Action API internal changes in 1.25 ===
* ApiHelp has been rewritten to support i18n and paginated HTML output.
diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index 1417ef7..e72383e 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -450,6 +450,9 @@
if ( $titleTo->hasFragment() ) {
$r['tofragment'] = $titleTo->getFragment();
}
+ if ( $titleTo->isExternal() ) {
+ $r['tointerwiki'] = $titleTo->getInterwiki();
+ }
$values[] = $r;
}
if ( !empty( $values ) && $result ) {
@@ -1049,7 +1052,9 @@
$row->rd_interwiki
);
unset( $this->mPendingRedirectIDs[$rdfrom] );
- if ( !$to->isExternal() && !isset(
$this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
+ if ( $to->isExternal() ) {
+ $this->mInterwikiTitles[$to->getPrefixedText()]
= $to->getInterwiki();
+ } elseif ( !isset(
$this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
$lb->add( $row->rd_namespace, $row->rd_title );
}
$this->mRedirectTitles[$from] = $to;
--
To view, visit https://gerrit.wikimedia.org/r/182081
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf1346f52c8efa099b502433de1b18c4caad09df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits