Do not returning external title in ApiPageSet::getRedirectTargets
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 11 May 2013 18:44:55 +0000 (20:44 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 22 May 2013 14:04:19 +0000 (14:04 +0000)
Having a page with a redirect to "en:Main Page" will be added as "Main
Page" to the output, that is wrong

http://test.wikipedia.org/w/api.php?action=query&titles=Redirect%20to%20interwiki%20page&redirects

Change-Id: I7b59f592c1293dbb96f4c4279201bf04fcfea29d

includes/api/ApiPageSet.php

index fbe5973..9fdad2b 100644 (file)
@@ -862,7 +862,7 @@ class ApiPageSet extends ApiBase {
                        $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
                        $to = Title::makeTitle( $row->rd_namespace, $row->rd_title, $row->rd_fragment, $row->rd_interwiki );
                        unset( $this->mPendingRedirectIDs[$rdfrom] );
-                       if ( !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
+                       if ( !$to->isExternal() && !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
                                $lb->add( $row->rd_namespace, $row->rd_title );
                        }
                        $this->mRedirectTitles[$from] = $to;