From: Kevin Israel Date: Sat, 28 Feb 2015 09:54:48 +0000 (-0500) Subject: refreshLinks.php: Tweak exit condition in deleteLinksFromNonexistent() X-Git-Tag: 1.31.0-rc.0~12242^2 X-Git-Url: http://git.cyclocoop.org/%27-%20%20.%20url_absolue%28find_in_path%28%27spip_style.css%27%29%29%20%20%20.%20url_absolue%28find_in_path%28%27prive/spip_style.css%27%29%29%20.%20%27?a=commitdiff_plain;h=1976b1a6fd07f58f30ebc6d32f0592efca9cbc17;p=lhc%2Fweb%2Fwiklou.git refreshLinks.php: Tweak exit condition in deleteLinksFromNonexistent() Instead of exiting the do...while loop only once a query returns zero rows, exit whenever fewer rows than the batch size are returned. This could save quite a bit of time when the highest nonexistent page_id found is a relatively low one. Follows-up 40e300b8273d. Bug: T44180 Change-Id: I14d2d48c2405fcc0bd05a3181ba6293caef5298c --- diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 7c85a1ccf9..b2f7497469 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -284,7 +284,7 @@ class RefreshLinks extends Maintenance { $this->output( "0.." ); do { - $list = $dbr->selectFieldValues( + $ids = $dbr->selectFieldValues( $table, $field, array( @@ -295,15 +295,16 @@ class RefreshLinks extends Maintenance { array( 'DISTINCT', 'ORDER BY' => $field, 'LIMIT' => $batchSize ) ); - if ( $list ) { - $counter += count( $list ); + $numIds = count( $ids ); + if ( $numIds ) { + $counter += $numIds; wfWaitForSlaves(); - $dbw->delete( $table, array( $field => $list ), __METHOD__ ); + $dbw->delete( $table, array( $field => $ids ), __METHOD__ ); $this->output( $counter . ".." ); - $start = $list[count( $list ) - 1] + 1; + $start = $ids[$numIds - 1] + 1; } - } while ( $list ); + } while ( $numIds >= $batchSize ); $this->output( "\n" ); wfWaitForSlaves();