X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdeleteBatch.php;h=eceadc11119c6aabe4e0101d19317c53439373b4;hb=b5d5ba64dbd22c09e3cdfd10ef90bb29829c3c1e;hp=6c89e671eabecabb364ced4255b9f7efb30d6dc2;hpb=bee82be112de5180a255655958b151d11340182e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php index 6c89e671ea..eceadc1111 100644 --- a/maintenance/deleteBatch.php +++ b/maintenance/deleteBatch.php @@ -39,7 +39,7 @@ class DeleteBatch extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Deletes a batch of pages"; + $this->addDescription( 'Deletes a batch of pages' ); $this->addOption( 'u', "User to perform deletion", false, true ); $this->addOption( 'r', "Reason to delete page", false, true ); $this->addOption( 'i', "Interval to sleep between deletions" ); @@ -60,12 +60,12 @@ class DeleteBatch extends Maintenance { $interval = $this->getOption( 'i', 0 ); if ( $username === false ) { - $user = User::newSystemUser( 'Delete page script', array( 'steal' => true ) ); + $user = User::newSystemUser( 'Delete page script', [ 'steal' => true ] ); } else { $user = User::newFromName( $username ); } if ( !$user ) { - $this->error( "Invalid username", true ); + $this->fatalError( "Invalid username" ); } $wgUser = $user; @@ -77,7 +77,7 @@ class DeleteBatch extends Maintenance { # Setup if ( !$file ) { - $this->error( "Unable to read file, exiting", true ); + $this->fatalError( "Unable to read file, exiting" ); } $dbw = $this->getDB( DB_MASTER ); @@ -102,7 +102,7 @@ class DeleteBatch extends Maintenance { $this->output( $title->getPrefixedText() ); if ( $title->getNamespace() == NS_FILE ) { - $img = wfFindFile( $title, array( 'ignoreRedirect' => true ) ); + $img = wfFindFile( $title, [ 'ignoreRedirect' => true ] ); if ( $img && $img->isLocal() && !$img->delete( $reason ) ) { $this->output( " FAILED to delete associated file... " ); }