r78780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78779‎ | r78780 | r78781 >
Date:11:59, 22 December 2010
Author:catrope
Status:deferred
Tags:
Comment:
Various fixes for r49951: use array_merge() instead of + so as to not overwrite the first element of $wgContentNamespaces, avoid use of empty() and clean up code style
Modified paths:
  • /branches/querypage-work2/phase3/includes/Namespace.php (modified) (history)

Diff [purge]

Index: branches/querypage-work2/phase3/includes/Namespace.php
@@ -240,22 +240,18 @@
241241
242242 /**
243243 * Get a list of all namespace indices which are considered to contain content
244 - *
245 - * If only one content namespace exists, returns that single index (Int)
246 - * If multiple content namespaces exist, it returns an array of indices
247 - *
248 - * @return mixed
 244+ * @return array of namespace indices
249245 */
250246 public static function getContentNamespaces() {
251247 global $wgContentNamespaces;
252 - if( empty( $wgContentNamespaces ) )
 248+ if( !is_array( $wgContentNamespaces ) || $wgContentNamespaces === array() ) {
253249 return NS_MAIN;
254 - // always force NS_MAIN to be part of array (to match the algorithm used by isContent)
255 - elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) )
256 - return array( NS_MAIN ) + $wgContentNamespaces;
257 - else
 250+ } elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) ) {
 251+ // always force NS_MAIN to be part of array (to match the algorithm used by isContent)
 252+ return array_merge( array( NS_MAIN ), $wgContentNamespaces );
 253+ } else {
258254 return $wgContentNamespaces;
259 -
 255+ }
260256 }
261257 /**
262258 * Is the namespace first-letter capitalized?

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49951querypage-work: (bug 8130) Query pages should limit to $wgContentNamespaces r...catrope13:29, 27 April 2009

Status & tagging log