Merge "Revert "Prevent the jumbling up of autocomments in RTL""
[lhc/web/wiklou.git] / maintenance / refreshLinks.php
index 5d311ad..763d97e 100644 (file)
@@ -327,13 +327,14 @@ class RefreshLinks extends Maintenance {
 
                foreach ( $linksTables as $table => $field ) {
                        $this->output( "    $table: 0" );
+                       $tableStart = $start;
                        $counter = 0;
                        do {
                                $ids = $dbr->selectFieldValues(
                                        $table,
                                        $field,
                                        array(
-                                               self::intervalCond( $dbr, $field, $start, $end ),
+                                               self::intervalCond( $dbr, $field, $tableStart, $end ),
                                                "$field NOT IN ({$dbr->selectSQLText( 'page', 'page_id' )})",
                                        ),
                                        __METHOD__,
@@ -343,17 +344,15 @@ class RefreshLinks extends Maintenance {
                                $numIds = count( $ids );
                                if ( $numIds ) {
                                        $counter += $numIds;
-                                       wfWaitForSlaves();
                                        $dbw->delete( $table, array( $field => $ids ), __METHOD__ );
                                        $this->output( ", $counter" );
-                                       $start = $ids[$numIds - 1] + 1;
+                                       $tableStart = $ids[$numIds - 1] + 1;
+                                       wfWaitForSlaves();
                                }
 
-                       } while ( $numIds >= $batchSize && ( $end === null || $start <= $end ) );
+                       } while ( $numIds >= $batchSize && ( $end === null || $tableStart <= $end ) );
 
                        $this->output( " deleted.\n" );
-
-                       wfWaitForSlaves();
                }
        }