* Do some sanity checking and basic setup
*/
public function setup() {
- global $wgCommandLineMode, $wgRequestTime;
+ global $IP, $wgCommandLineMode, $wgRequestTime;
# Abort if called from a web server
if ( isset( $_SERVER ) && isset( $_SERVER['REQUEST_METHOD'] ) ) {
$this->error( 'This script must be run from the command line', true );
}
+ if ( $IP === null ) {
+ $this->error( "\$IP not set, aborting!\n" .
+ '(Did you forget to call parent::__construct() in your maintenance script?)', 1 );
+ }
+
# Make sure we can handle script parameters
if ( !defined( 'HPHP_VERSION' ) && !ini_get( 'register_argc_argv' ) ) {
$this->error( 'Cannot get command line arguments, register_argc_argv is set to false', true );
$this->output( "\n" );
}
-
// Script specific parameters not defined on construction by
// Maintenance::addDefaultParams()
$scriptSpecificParams = array_diff_key(
$db = $this->getDB( DB_MASTER );
$key = $this->getUpdateKey();
- if ( !$this->hasOption( 'force' ) &&
- $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ ) )
- {
+ if ( !$this->hasOption( 'force' )
+ && $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ )
+ ) {
$this->output( "..." . $this->updateSkippedMessage() . "\n" );
return true;
}
return false;
}
- if (
- $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) )
- {
+ if ( $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) ) {
return true;
} else {
$this->output( $this->updatelogFailedMessage() . "\n" );