Allowing user functions to work in command-line scripts, this will probably break...
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 8 Jan 2005 09:17:33 +0000 (09:17 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 8 Jan 2005 09:17:33 +0000 (09:17 +0000)
includes/User.php
maintenance/updaters.inc

index c1cfa84..ffd7e0c 100644 (file)
@@ -381,7 +381,11 @@ class User {
        function loadFromDatabase() {
                global $wgCommandLineMode, $wgAnonGroupId, $wgLoggedInGroupId;
                $fname = "User::loadFromDatabase";
-               if ( $this->mDataLoaded || $wgCommandLineMode ) {
+               
+               # Counter-intuitive, breaks various things, use User::setLoaded() if you want to suppress 
+               # loading in a command line script, don't assume all command line scripts need it like this
+               #if ( $this->mDataLoaded || $wgCommandLineMode ) {
+               if ( $this->mDataLoaded ) {
                        return;
                }
 
index f175af4..47238c0 100644 (file)
@@ -162,9 +162,6 @@ function do_copy_newtalk_to_watchlist() {
        global $wgDatabase;
        global $wgCommandLineMode;      # this needs to be saved while getID() and getName() are called
 
-       $CommandLineMode_save = $wgCommandLineMode;
-       $wgCommandLineMode = false;     # otherwise User:loadfromDatabase() early returns, but we need it herein
-
        if ( $wgDatabase->tableExists( 'user_newtalk' ) ) {
                $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !',
                        $wgDatabase->tableName( 'user_newtalk' ) );
@@ -206,7 +203,6 @@ function do_copy_newtalk_to_watchlist() {
        } else {
                echo "ENOTIF: No user_newtalk table found. Nothing to convert to watchlist table entries.\n";
        }
-       $wgCommandLineMode = $CommandLineMode_save;
 }