Merge "Drop index oi_name_archive_name on table oldimage"
[lhc/web/wiklou.git] / maintenance / importImages.php
index 7f2a9e1..23bdb3f 100644 (file)
@@ -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
@@ -496,7 +497,7 @@ class ImportImages extends Maintenance {
        # (preferably batching files too).
        private function getFileCommentFromSourceWiki( $wiki_host, $file ) {
                $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
-                          . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
+                       . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
                $body = Http::get( $url, [], __METHOD__ );
                if ( preg_match( '#<ii comment="([^"]*)" />#', $body, $matches ) == 0 ) {
                        return false;
@@ -507,7 +508,7 @@ class ImportImages extends Maintenance {
 
        private function getFileUserFromSourceWiki( $wiki_host, $file ) {
                $url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
-                          . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
+                       . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
                $body = Http::get( $url, [], __METHOD__ );
                if ( preg_match( '#<ii user="([^"]*)" />#', $body, $matches ) == 0 ) {
                        return false;