From 023a5b6ae0177fa4681c0b4575e935429c81d13e Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 28 Jan 2005 05:10:05 +0000 Subject: [PATCH] s/0/NS_MAIN/ --- includes/Article.php | 4 +++- includes/SearchEngine.php | 2 +- includes/SpecialUncategorizedpages.php | 2 +- includes/Title.php | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 48d0b85941..293a6d0057 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -444,11 +444,13 @@ class Article { /** * Would the given text make this article a "good" article (i.e., * suitable for including in the article count)? + * @param string $text Text to analyze + * @return integer 1 if it can be counted else 0 */ function isCountable( $text ) { global $wgUseCommaCount; - if ( 0 != $this->mTitle->getNamespace() ) { return 0; } + if ( NS_MAIN != $this->mTitle->getNamespace() ) { return 0; } if ( $this->isRedirect( $text ) ) { return 0; } $token = ($wgUseCommaCount ? ',' : '[[' ); if ( false === strstr( $text, $token ) ) { return 0; } diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 90e2671899..2e83974c8f 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -120,7 +120,7 @@ class SearchEngine { global $wgContLang; $arr = array(); foreach( $wgContLang->getNamespaces() as $ns => $name ) { - if( $ns >= 0 ) { + if( $ns >= NS_MAIN ) { $arr[$ns] = $name; } } diff --git a/includes/SpecialUncategorizedpages.php b/includes/SpecialUncategorizedpages.php index d35a889ecc..4487c3c411 100755 --- a/includes/SpecialUncategorizedpages.php +++ b/includes/SpecialUncategorizedpages.php @@ -16,7 +16,7 @@ require_once( "QueryPage.php" ); * @subpackage SpecialPage */ class UncategorizedPagesPage extends PageQueryPage { - var $requestedNamespace = 0; + var $requestedNamespace = NS_MAIN; function getName() { return "Uncategorizedpages"; diff --git a/includes/Title.php b/includes/Title.php index cfb5f499e0..b42254ea63 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -59,7 +59,7 @@ class Title { $this->mInterwiki = $this->mUrlform = $this->mTextform = $this->mDbkeyform = ''; $this->mArticleID = -1; - $this->mNamespace = 0; + $this->mNamespace = NS_MAIN; $this->mRestrictionsLoaded = false; $this->mRestrictions = array(); # Dont change the following, NS_MAIN is hardcoded in several place @@ -98,7 +98,7 @@ class Title { * @static * @access public */ - /* static */ function &newFromText( $text, $defaultNamespace = 0 ) { + function &newFromText( $text, $defaultNamespace = NS_MAIN ) { $fname = 'Title::newFromText'; wfProfileIn( $fname ); @@ -111,7 +111,7 @@ class Title { * In theory these are value objects and won't get changed... */ static $titleCache = array(); - if( $defaultNamespace == 0 && isset( $titleCache[$text] ) ) { + if( $defaultNamespace == NS_MAIN && isset( $titleCache[$text] ) ) { wfProfileOut( $fname ); return $titleCache[$text]; } @@ -136,7 +136,7 @@ class Title { $t->mDefaultNamespace = $defaultNamespace; if( $t->secureAndSplit() ) { - if( $defaultNamespace == 0 ) { + if( $defaultNamespace == NS_MAIN ) { if( count( $titleCache ) >= MW_TITLECACHE_MAX ) { # Avoid memory leaks on mass operations... $titleCache = array(); -- 2.20.1