From 8c813c3c92f811cedfc49685a3ae1c16821258ba Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 16 Feb 2009 12:19:29 +0000 Subject: [PATCH] Redo r47313 in a more readable way (probably more efficient too) by not using all those array_* functions --- includes/api/ApiQuerySiteinfo.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 ); -- 2.20.1