* @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->fatalError( "Unable to read file, exiting" );
}
- $dbw = $this->getDB( DB_MASTER );
-
# Handle each entry
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
for ( $linenum = 1; !feof( $file ); $linenum++ ) {
$line = trim( fgets( $file ) );
if ( $line == '' ) {
$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... " );
}
}
$page = WikiPage::factory( $title );
$error = '';
- $success = $page->doDeleteArticle( $reason, false, 0, true, $error, $user );
+ $success = $page->doDeleteArticle( $reason, false, null, null, $error, $user, true );
if ( $success ) {
$this->output( " Deleted!\n" );
} else {