r44694 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44693‎ | r44694 | r44695 >
Date:23:57, 16 December 2008
Author:brion
Status:ok
Tags:
Comment:
Cleanup r44683 -- fix E_NOTICE bug in MWNamespace::getCanonicalName() instead of replicating the function. :)
(Also note -- using MWNamespace instead of Namespace for PHP 5.3 compat.)
Modified paths:
  • /trunk/phase3/includes/Namespace.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -127,7 +127,7 @@
128128 }
129129
130130 protected function appendNamespaces( $property ) {
131 - global $wgContLang, $wgCanonicalNamespaceNames;
 131+ global $wgContLang;
132132 $data = array();
133133 foreach( $wgContLang->getFormattedNamespaces() as $ns => $title )
134134 {
@@ -135,7 +135,7 @@
136136 'id' => $ns
137137 );
138138 ApiResult :: setContent( $data[$ns], $title );
139 - $canonical = isset($wgCanonicalNamespaceNames[$ns]) ? $wgCanonicalNamespaceNames[$ns] : false;
 139+ $canonical = MWNamespace::getCanonicalName( $ns );
140140
141141 if( MWNamespace::hasSubpages( $ns ) )
142142 $data[$ns]['subpages'] = '';
Index: trunk/phase3/includes/Namespace.php
@@ -105,11 +105,15 @@
106106 * Returns the canonical (English Wikipedia) name for a given index
107107 *
108108 * @param $index Int: namespace index
109 - * @return string
 109+ * @return string or false if no canonical definition.
110110 */
111111 public static function getCanonicalName( $index ) {
112112 global $wgCanonicalNamespaceNames;
113 - return $wgCanonicalNamespaceNames[$index];
 113+ if( isset( $wgCanonicalNamespaceNames[$index] ) ) {
 114+ return $wgCanonicalNamespaceNames[$index];
 115+ } else {
 116+ return false;
 117+ }
114118 }
115119
116120 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44683Fix for r44676, fix E_NOTICE from having no canonical name associated with a ...mrzman19:59, 16 December 2008

Status & tagging log