MediaWiki r14738 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r14737‎ | r14738 (on ViewVC)‎ | r14739 >
Date:11:59, 12 June 2006
Author:robchurch
Status:old
Tags:
Comment:
Introduce $wgContentNamespaces which allows for articles to exist in namespaces other than the main namespace, and still be counted as valid content in the site statistics.
Modified paths:

Diff [purge]

Index: trunk/phase3/maintenance/initStats.php
===================================================================
--- trunk/phase3/maintenance/initStats.php	(revision 14737)
+++ trunk/phase3/maintenance/initStats.php	(revision 14738)
@@ -25,7 +25,8 @@
 $edits = $dbr->selectField( 'revision', 'COUNT(*)', '', $fname );
 echo( "{$edits}\nCounting number of articles..." );
 
-$good  = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => 0, 'page_is_redirect' => 0, 'page_len > 0' ), $fname );
+global $wgContentNamespaces;
+$good  = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $wgContentNamespaces, 'page_is_redirect' => 0, 'page_len > 0' ), $fname );
 echo( "{$good}\nCounting total pages..." );
 
 $pages = $dbr->selectField( 'page', 'COUNT(*)', '', $fname );
Index: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php	(revision 14737)
+++ trunk/phase3/includes/Article.php	(revision 14738)
@@ -538,11 +538,11 @@
 	 * @return bool
 	 */
 	function isCountable( $text ) {
-		global $wgUseCommaCount;
+		global $wgUseCommaCount, $wgContentNamespaces;
 
 		$token = $wgUseCommaCount ? ',' : '[[';
 		return
-			$this->mTitle->getNamespace() == NS_MAIN
+			array_search( $this->mTitle->getNamespace(), $wgContentNamespaces ) !== false
 			&& ! $this->isRedirect( $text )
 			&& in_string( $token, $text );
 	}
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 14737)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 14738)
@@ -2067,4 +2067,12 @@
  */
 $wgAllowTitlesInSVG = false;
 
+/**
+ * Array of namespaces which can be deemed to contain valid "content", as far
+ * as the site statistics are concerned. Useful if additional namespaces also
+ * contain "content" which should be considered when generating a count of the
+ * number of articles in the wiki.
+ */
+$wgContentNamespaces = array( NS_MAIN );
+
 ?>
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 14737)
+++ trunk/phase3/RELEASE-NOTES	(revision 14738)
@@ -476,8 +476,9 @@
   for new normalization code when tidy not in use
 * Replace "nogomatch" with "noexactmatch" and place the magic colon in the messages
   themselves. Some minor tweaks to the actual message content.
+* Introduce $wgContentNamespaces which allows for articles to exist in namespaces other
+  than the main namespace, and still be counted as valid content in the site statistics.
 
-
 == Compatibility ==
 
 MediaWiki 1.7 requires PHP 5 (5.1 recommended). PHP 4 is no longer supported.

Status & tagging log

  • 01:58, 13 October 2010 ^demon (Talk | contribs) changed the status of r14738 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox