X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FimportImages.php;h=d3aa280a345d2ca6dd8aedcc11af7c6051e729f2;hp=b3866c13a2e38f791ade1916c68407c44824350d;hb=c16af68fb62948dd8079a7fa49b7c12b9a748121;hpb=16a9c7076f5eb5279d6eb1384751a08a4e33f532 diff --git a/maintenance/importImages.php b/maintenance/importImages.php index b3866c13a2..d3aa280a34 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -133,11 +133,11 @@ class ImportImages extends Maintenance { # Check Protection if ( $this->hasOption( 'protect' ) && $this->hasOption( 'unprotect' ) ) { - $this->error( "Cannot specify both protect and unprotect. Only 1 is allowed.\n", 1 ); + $this->fatalError( "Cannot specify both protect and unprotect. Only 1 is allowed.\n" ); } if ( $this->hasOption( 'protect' ) && trim( $this->getOption( 'protect' ) ) ) { - $this->error( "You must specify a protection option.\n", 1 ); + $this->fatalError( "You must specify a protection option.\n" ); } # Prepare the list of allowed extensions @@ -170,7 +170,7 @@ class ImportImages extends Maintenance { if ( $commentFile !== null ) { $comment = file_get_contents( $commentFile ); if ( $comment === false || $comment === null ) { - $this->error( "failed to read comment file: {$commentFile}\n", 1 ); + $this->fatalError( "failed to read comment file: {$commentFile}\n" ); } } else { $comment = $this->getOption( 'comment', 'Importing file' ); @@ -185,9 +185,7 @@ class ImportImages extends Maintenance { # Batch "upload" operation $count = count( $files ); if ( $count > 0 ) { - foreach ( $files as $file ) { - if ( $sleep && ( $processed > 0 ) ) { sleep( $sleep ); } @@ -301,7 +299,7 @@ class ImportImages extends Maintenance { " publishing {$file} by '{$wgUser->getName()}', comment '$commentText'... " ); } else { - $mwProps = new MWFileProps( MimeMagic::singleton() ); + $mwProps = new MWFileProps( MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer() ); $props = $mwProps->getPropsFromPath( $file, true ); $flags = 0; $publishOptions = []; @@ -336,7 +334,7 @@ class ImportImages extends Maintenance { $commentText, $props, $timestamp - ) ) { + )->isOK() ) { # We're done! $this->output( "done.\n" );