* @ingroup Maintenance
*/
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/Maintenance.php';
/**
}
$wgUser = $user;
- if ( $this->hasArg() ) {
- $file = fopen( $this->getArg(), 'r' );
+ if ( $this->hasArg( 0 ) ) {
+ $file = fopen( $this->getArg( 0 ), 'r' );
} else {
$file = $this->getStdin();
}
$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... " );
}