From e12289e771f8c7f46172159a7cd3930206c955d8 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 27 Mar 2004 22:47:25 +0000 Subject: [PATCH] alterations to allow a command-line wikitext processor --- includes/Parser.php | 14 ++++++++++++-- includes/User.php | 12 +++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index e4204456d0..d44ce172ab 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1627,7 +1627,7 @@ class Parser function preSaveTransform( $text, &$title, &$user, $options, $clearState = true ) { $this->mOptions = $options; - $this->mTitle = $title; + $this->mTitle =& $title; $this->mOutputType = OT_WIKI; if ( $clearState ) { @@ -1713,7 +1713,17 @@ class Parser return $text; } - + # Set up some variables which are usually set up in parse() + # so that an external function can call some class members with confidence + function startExternalParse( &$title, $options, $outputType, $clearState = true ) + { + $this->mTitle =& $title; + $this->mOptions = $options; + $this->mOutputType = $outputType; + if ( $clearState ) { + $this->clearState(); + } + } } class ParserOutput diff --git a/includes/User.php b/includes/User.php index 1f6ff8fc2f..a6f1fb56fa 100644 --- a/includes/User.php +++ b/includes/User.php @@ -424,7 +424,9 @@ class User { function isBot() { $this->loadFromDatabase(); - if ( 0 == $this->mId ) { return false; } + + # Why was this here? I need a UID=0 conversion script [TS] + # if ( 0 == $this->mId ) { return false; } return in_array( "bot", $this->mRights ); } @@ -669,8 +671,12 @@ class User { return $allowed; } - - + # Set mDataLoaded, return previous value + # Use this to prevent DB access in command-line scripts or similar situations + function setLoaded( $loaded ) + { + wfSetVar( $this->mDataLoaded, $loaded ); + } } ?> -- 2.20.1