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
@@ -25,7 +25,8 @@
2626 $edits = $dbr->selectField( 'revision', 'COUNT(*)', '', $fname );
2727 echo( "{$edits}\nCounting number of articles..." );
2828
29 -$good = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => 0, 'page_is_redirect' => 0, 'page_len > 0' ), $fname );
 29+global $wgContentNamespaces;
 30+$good = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $wgContentNamespaces, 'page_is_redirect' => 0, 'page_len > 0' ), $fname );
3031 echo( "{$good}\nCounting total pages..." );
3132
3233 $pages = $dbr->selectField( 'page', 'COUNT(*)', '', $fname );
Index: trunk/phase3/includes/Article.php
@@ -538,11 +538,11 @@
539539 * @return bool
540540 */
541541 function isCountable( $text ) {
542 - global $wgUseCommaCount;
 542+ global $wgUseCommaCount, $wgContentNamespaces;
543543
544544 $token = $wgUseCommaCount ? ',' : '[[';
545545 return
546 - $this->mTitle->getNamespace() == NS_MAIN
 546+ array_search( $this->mTitle->getNamespace(), $wgContentNamespaces ) !== false
547547 && ! $this->isRedirect( $text )
548548 && in_string( $token, $text );
549549 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2067,4 +2067,12 @@
20682068 */
20692069 $wgAllowTitlesInSVG = false;
20702070
 2071+/**
 2072+ * Array of namespaces which can be deemed to contain valid "content", as far
 2073+ * as the site statistics are concerned. Useful if additional namespaces also
 2074+ * contain "content" which should be considered when generating a count of the
 2075+ * number of articles in the wiki.
 2076+ */
 2077+$wgContentNamespaces = array( NS_MAIN );
 2078+
20712079 ?>
Index: trunk/phase3/RELEASE-NOTES
@@ -476,8 +476,9 @@
477477 for new normalization code when tidy not in use
478478 * Replace "nogomatch" with "noexactmatch" and place the magic colon in the messages
479479 themselves. Some minor tweaks to the actual message content.
 480+* Introduce $wgContentNamespaces which allows for articles to exist in namespaces other
 481+ than the main namespace, and still be counted as valid content in the site statistics.
480482
481 -
482483 == Compatibility ==
483484
484485 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]