s/0/NS_MAIN/

This commit is contained in:
Antoine Musso 2005-01-28 05:10:05 +00:00
parent 4f74981100
commit 023a5b6ae0
4 changed files with 9 additions and 7 deletions

View file

@ -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; }

View file

@ -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;
}
}

View file

@ -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";

View file

@ -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();