Services: Convert PasswordReset's static to a const now HHVM is gone
[lhc/web/wiklou.git] / maintenance / deleteBatch.php
index fe3bea0..ee6e3e5 100644 (file)
@@ -28,6 +28,8 @@
  * @ingroup Maintenance
  */
 
+use MediaWiki\MediaWikiServices;
+
 require_once __DIR__ . '/Maintenance.php';
 
 /**
@@ -69,8 +71,8 @@ class DeleteBatch extends Maintenance {
                }
                $wgUser = $user;
 
-               if ( $this->hasArg() ) {
-                       $file = fopen( $this->getArg(), 'r' );
+               if ( $this->hasArg( 0 ) ) {
+                       $file = fopen( $this->getArg( 0 ), 'r' );
                } else {
                        $file = $this->getStdin();
                }
@@ -98,7 +100,9 @@ class DeleteBatch extends Maintenance {
 
                        $this->output( $title->getPrefixedText() );
                        if ( $title->getNamespace() == NS_FILE ) {
-                               $img = wfFindFile( $title, [ 'ignoreRedirect' => true ] );
+                               $img = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
+                                       $title, [ 'ignoreRedirect' => true ]
+                               );
                                if ( $img && $img->isLocal() && !$img->delete( $reason ) ) {
                                        $this->output( " FAILED to delete associated file... " );
                                }