Merge "wfEmptyMsg() was removed"
[lhc/web/wiklou.git] / maintenance / deleteBatch.php
index e6321e1..6c89e67 100644 (file)
@@ -55,11 +55,15 @@ class DeleteBatch extends Maintenance {
                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 );
                }
@@ -76,7 +80,7 @@ class DeleteBatch extends Maintenance {
                        $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