From: Brad Jorsch Date: Sat, 2 Jun 2012 20:20:14 +0000 (+0200) Subject: (bug 30836) API siteinfo specialpagealiases should not return nonexistent special... X-Git-Tag: 1.31.0-rc.0~23002 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=5dc1a63f204c3167cc9d497d02aca4e517ca5288;p=lhc%2Fweb%2Fwiklou.git (bug 30836) API siteinfo specialpagealiases should not return nonexistent special pages Some special pages are conditionally registered (e.g. Special:Popularpages only exists when $wgDisableCounters is false), or sometimes an alias exists for a special page that does not. The API should probably not return entries for these from meta=siteinfo&siprop=specialpagealiases. This also fixes bug 38464 correctly, rather than blindly reverting. Change-Id: Ic021a47754ea7a1574e818dad47151ab6698e06f --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 8bebaaacc4..ed9259360f 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -193,6 +193,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * (bug 35980) list=deletedrevs now honors drdir correctly in "all" mode (mode #3). * (bug 29290) API avoids mangling fields in continuation parameters * (bug 36987) API avoids mangling fields in continuation parameters +* (bug 30836) siteinfo prop=specialpagealiases will no longer return nonexistent special pages === Languages updated in 1.20 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 8e01d3a4eb..ec503d64a5 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -257,10 +257,13 @@ class ApiQuerySiteinfo extends ApiQueryBase { protected function appendSpecialPageAliases( $property ) { global $wgContLang; $data = array(); - foreach ( $wgContLang->getSpecialPageAliases() as $specialpage => $aliases ) { - $arr = array( 'realname' => $specialpage, 'aliases' => $aliases ); - $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' ); - $data[] = $arr; + $aliases = $wgContLang->getSpecialPageAliases(); + foreach ( SpecialPageFactory::getList() as $specialpage => $stuff ) { + if ( isset( $aliases[$specialpage] ) ) { + $arr = array( 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] ); + $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' ); + $data[] = $arr; + } } $this->getResult()->setIndexedTagName( $data, 'specialpage' ); return $this->getResult()->addValue( 'query', $property, $data );