From: Roan Kattouw Date: Mon, 16 Feb 2009 12:19:29 +0000 (+0000) Subject: Redo r47313 in a more readable way (probably more efficient too) by not using all... X-Git-Tag: 1.31.0-rc.0~42877 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=8c813c3c92f811cedfc49685a3ae1c16821258ba;p=lhc%2Fweb%2Fwiklou.git Redo r47313 in a more readable way (probably more efficient too) by not using all those array_* functions --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 7e72a8f0e8..27965aa9fa 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -167,10 +167,14 @@ class ApiQuerySiteinfo extends ApiQueryBase { protected function appendNamespaceAliases( $property ) { global $wgNamespaceAliases, $wgContLang; $wgContLang->load(); - $aliases = array_merge($wgNamespaceAliases, $wgContLang->namespaceAliases); - $aliases = array_diff_key($aliases, array_flip($wgContLang->getNamespaces())); + $aliases = array_merge( $wgNamespaceAliases, $wgContLang->namespaceAliases ); + $namespaces = $wgContLang->getNamespaces(); $data = array(); foreach( $aliases as $title => $ns ) { + if( $namespaces[$ns] == $title ) { + // Don't list duplicates + continue; + } $item = array( 'id' => $ns );