From 493fc3dfe34e9de701bfd4ab27ce8ebbddcbf71f Mon Sep 17 00:00:00 2001 From: Liangent Date: Fri, 11 Jan 2013 17:00:32 +0800 Subject: [PATCH] (bug 43852) Fix converttitles param in api.php?action=query Change-Id: I1658202f9228c2b99c0895d9c9b1a6d905f3021d --- includes/api/ApiPageSet.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 0f5be6b24b..5fcb13231f 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -705,9 +705,10 @@ class ApiPageSet extends ApiQueryBase { if ( $this->mConvertTitles && count( $wgContLang->getVariants() ) > 1 && !$titleObj->exists() ) { - // Language::findVariantLink will modify titleObj into + // Language::findVariantLink will modify titleText and titleObj into // the canonical variant if possible - $wgContLang->findVariantLink( $title, $titleObj ); + $titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText(); + $wgContLang->findVariantLink( $titleText, $titleObj ); $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText(); } @@ -728,7 +729,11 @@ class ApiPageSet extends ApiQueryBase { // namespace is localized or the capitalization is // different if ( $titleWasConverted ) { - $this->mConvertedTitles[$title] = $titleObj->getPrefixedText(); + $this->mConvertedTitles[$unconvertedTitle] = $titleObj->getPrefixedText(); + // In this case the page can't be Special. + if ( is_string( $title ) && $title !== $unconvertedTitle ) { + $this->mNormalizedTitles[$title] = $unconvertedTitle; + } } elseif ( is_string( $title ) && $title !== $titleObj->getPrefixedText() ) { $this->mNormalizedTitles[$title] = $titleObj->getPrefixedText(); } -- 2.20.1