Merge "Title::getTalkPage(): Restore behavior of interwiki-prefixed & fragment-only...
[lhc/web/wiklou.git] / includes / jobqueue / utils / PurgeJobUtils.php
index ef364b5..1e40eb4 100644 (file)
@@ -65,7 +65,8 @@ class PurgeJobUtils {
 
                                $batchSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' );
                                $ticket = $lbFactory->getEmptyTransactionTicket( $fname );
-                               foreach ( array_chunk( $ids, $batchSize ) as $idBatch ) {
+                               $idBatches = array_chunk( $ids, $batchSize );
+                               foreach ( $idBatches as $idBatch ) {
                                        $dbw->update(
                                                'page',
                                                [ 'page_touched' => $now ],
@@ -75,7 +76,9 @@ class PurgeJobUtils {
                                                ],
                                                $fname
                                        );
-                                       $lbFactory->commitAndWaitForReplication( $fname, $ticket );
+                                       if ( count( $idBatches ) > 1 ) {
+                                               $lbFactory->commitAndWaitForReplication( $fname, $ticket );
+                                       }
                                }
                        }
                ) );