r47315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47314‎ | r47315 | r47316 >
Date:12:19, 16 February 2009
Author:catrope
Status:ok
Tags:
Comment:
Redo r47313 in a more readable way (probably more efficient too) by not using all those array_* functions
Modified paths:
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -167,10 +167,14 @@
168168 protected function appendNamespaceAliases( $property ) {
169169 global $wgNamespaceAliases, $wgContLang;
170170 $wgContLang->load();
171 - $aliases = array_merge($wgNamespaceAliases, $wgContLang->namespaceAliases);
172 - $aliases = array_diff_key($aliases, array_flip($wgContLang->getNamespaces()));
 171+ $aliases = array_merge( $wgNamespaceAliases, $wgContLang->namespaceAliases );
 172+ $namespaces = $wgContLang->getNamespaces();
173173 $data = array();
174174 foreach( $aliases as $title => $ns ) {
 175+ if( $namespaces[$ns] == $title ) {
 176+ // Don't list duplicates
 177+ continue;
 178+ }
175179 $item = array(
176180 'id' => $ns
177181 );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r47313API: (bug 17502) meta=siteinfo&siprop=namespacealiases no longer lists namesp...catrope11:20, 16 February 2009

Status & tagging log