chdir( $oldCwd );
# Options processing
- $username = $this->getOption( 'u', 'Delete page script' );
+ $username = $this->getOption( 'u', false );
$reason = $this->getOption( 'r', '' );
$interval = $this->getOption( 'i', 0 );
- $user = User::newFromName( $username );
+ if ( $username === false ) {
+ $user = User::newSystemUser( 'Delete page script', array( 'steal' => true ) );
+ } else {
+ $user = User::newFromName( $username );
+ }
if ( !$user ) {
$this->error( "Invalid username", true );
}
$this->error( "Unable to read file, exiting", true );
}
- $dbw = wfGetDB( DB_MASTER );
+ $dbw = $this->getDB( DB_MASTER );
# Handle each entry
// @codingStandardsIgnoreStart Ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed