Introduce $wgContentNamespaces which allows for articles to exist in namespaces other...
authorRob Church <robchurch@users.mediawiki.org>
Mon, 12 Jun 2006 11:59:12 +0000 (11:59 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 12 Jun 2006 11:59:12 +0000 (11:59 +0000)
RELEASE-NOTES
includes/Article.php
includes/DefaultSettings.php
maintenance/initStats.php

index 569a499..a18f40d 100644 (file)
@@ -476,7 +476,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   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 ==
 
index ecd5410..2b31493 100644 (file)
@@ -538,11 +538,11 @@ class Article {
         * @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 8872531..782af96 100644 (file)
@@ -2067,4 +2067,12 @@ $wgReservedUsernames = array( 'MediaWiki default', 'Conversion script' );
  */
 $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 06bb767..b622c3f 100644 (file)
@@ -25,7 +25,8 @@ echo( "Counting total edits..." );
 $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 );