From: Sébastien Santoro Date: Mon, 16 Jan 2017 15:14:34 +0000 (+0000) Subject: maintenance/importImages: Don't sleep after the last upload X-Git-Tag: 1.31.0-rc.0~4315 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=7840373fd3db32437498b9dda68cfcad44ac8226;p=lhc%2Fweb%2Fwiklou.git maintenance/importImages: Don't sleep after the last upload Currently, the importImages maintenance script offers an option to sleep an arbitrary amount of seconds after each upload. The current logic implementation had a side effect to also sleep after the last image upload. This is not a desired behavior, as the tasks are done and a clean exit with a report are welcome. Instead, sleep will now occur before the second upload and the ones to follow. Change-Id: Ia675f210582c3075e9b59b002a00cb1fc4b44cac --- diff --git a/maintenance/importImages.php b/maintenance/importImages.php index 7f2a9e1de0..4a3d2d6bad 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -187,6 +187,11 @@ class ImportImages extends Maintenance { if ( $count > 0 ) { foreach ( $files as $file ) { + + if ( $sleep && ( $processed > 0 ) ) { + sleep( $sleep ); + } + $base = UtfNormal\Validator::cleanUp( wfBaseName( $file ) ); # Validate a title @@ -375,10 +380,6 @@ class ImportImages extends Maintenance { if ( $limit && $processed >= $limit ) { break; } - - if ( $sleep ) { - sleep( $sleep ); - } } # Print out some statistics