From 26eba2d1f85aedff7454c04a123f291ca6906201 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 8 Jan 2005 09:17:33 +0000 Subject: [PATCH] Allowing user functions to work in command-line scripts, this will probably break one of them, not sure which one --- includes/User.php | 6 +++++- maintenance/updaters.inc | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/User.php b/includes/User.php index c1cfa84a74..ffd7e0cca7 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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; } diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index f175af43ad..47238c07e0 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -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; } -- 2.20.1