Redo r47313 in a more readable way (probably more efficient too) by not using all...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 16 Feb 2009 12:19:29 +0000 (12:19 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 16 Feb 2009 12:19:29 +0000 (12:19 +0000)
includes/api/ApiQuerySiteinfo.php

index 7e72a8f..27965aa 100644 (file)
@@ -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
                        );