r75583 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75582‎ | r75583 | r75584 >
Date:21:11, 27 October 2010
Author:hashar
Status:ok
Tags:
Comment:
Lame documentation, code style
Modified paths:
  • /trunk/phase3/includes/PrefixSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/PrefixSearch.php
@@ -22,6 +22,7 @@
2323 }
2424 $namespaces = self::validateNamespaces( $namespaces );
2525
 26+ // Find a Title which is not an interwiki and is in NS_MAIN
2627 $title = Title::newFromText( $search );
2728 if( $title && $title->getInterwiki() == '' ) {
2829 $ns = array($title->getNamespace());
@@ -162,10 +163,12 @@
163164 * Validate an array of numerical namespace indexes
164165 *
165166 * @param $namespaces Array
166 - * @return Array
 167+ * @return Array (default: contains only NS_MAIN)
167168 */
168169 protected static function validateNamespaces($namespaces){
169170 global $wgContLang;
 171+
 172+ // We will look at each given namespace against wgContLang namespaces
170173 $validNamespaces = $wgContLang->getNamespaces();
171174 if( is_array($namespaces) && count($namespaces)>0 ){
172175 $valid = array();
@@ -173,8 +176,9 @@
174177 if( is_numeric($ns) && array_key_exists($ns, $validNamespaces) )
175178 $valid[] = $ns;
176179 }
177 - if( count($valid) > 0 )
 180+ if( count($valid) > 0 ) {
178181 return $valid;
 182+ }
179183 }
180184
181185 return array( NS_MAIN );

Status & tagging log