X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=maintenance%2FeraseArchivedFile.php;h=49fadaa2d80233338267d45ae90e98b744b71da9;hb=ac619fc4a60f4d7538b0fda496f25d2eb7f0c220;hp=d94d49b72b46dd5699033907887ea314d048e23d;hpb=9b83841b9b44457b498770b847ac72f53031c34d;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/eraseArchivedFile.php b/maintenance/eraseArchivedFile.php index d94d49b72b..49fadaa2d8 100644 --- a/maintenance/eraseArchivedFile.php +++ b/maintenance/eraseArchivedFile.php @@ -21,6 +21,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -50,7 +52,7 @@ class EraseArchivedFile extends Maintenance { if ( $filekey === '*' ) { // all versions by name if ( !strlen( $filename ) ) { - $this->error( "Missing --filename parameter.", 1 ); + $this->fatalError( "Missing --filename parameter." ); } $afile = false; } else { // specified version @@ -60,15 +62,15 @@ class EraseArchivedFile extends Maintenance { [ 'fa_storage_group' => 'deleted', 'fa_storage_key' => $filekey ], __METHOD__, [], $fileQuery['joins'] ); if ( !$row ) { - $this->error( "No deleted file exists with key '$filekey'.", 1 ); + $this->fatalError( "No deleted file exists with key '$filekey'." ); } $filename = $row->fa_name; $afile = ArchivedFile::newFromRow( $row ); } - $file = wfLocalFile( $filename ); + $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile( $filename ); if ( $file->exists() ) { - $this->error( "File '$filename' is still a public file, use the delete form.\n", 1 ); + $this->fatalError( "File '$filename' is still a public file, use the delete form.\n" ); } $this->output( "Purging all thumbnails for file '$filename'..." ); @@ -115,5 +117,5 @@ class EraseArchivedFile extends Maintenance { } } -$maintClass = "EraseArchivedFile"; +$maintClass = EraseArchivedFile::class; require_once RUN_MAINTENANCE_IF_MAIN;