jenkins-bot has submitted this change and it was merged.

Change subject: refreshLinks.php: Fix deletion of link entries from nonexistent 
pages
......................................................................


refreshLinks.php: Fix deletion of link entries from nonexistent pages

After checking a chunk of one of the links tables, the script failed
to restore the original chunk start when checking the next table.

Follows-up a1e005155921.

Bug: T107632
Change-Id: I21678bc3c83946f2e62afe3fdc69c7e84678ceeb
(cherry picked from commit 6a1e956428adea767bba30093a64d0c2ba350bb4)
---
M RELEASE-NOTES-1.25
M maintenance/refreshLinks.php
2 files changed, 6 insertions(+), 3 deletions(-)

Approvals:
  TTO: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index e53dfbe..8e777fd 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -8,6 +8,8 @@
 === Changes since 1.25.2 ===
 
 * (T98975) Fix having multiple callbacks for a single hook.
+* (T107632) maintenance/refreshLinks.php did not always remove all links
+  pointing to nonexistent pages.
 
 == MediaWiki 1.25.2 ==
 
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index e1b6ac6..a2484aa 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -327,13 +327,14 @@
 
                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__,
@@ -346,10 +347,10 @@
                                        wfWaitForSlaves();
                                        $dbw->delete( $table, array( $field => 
$ids ), __METHOD__ );
                                        $this->output( ", $counter" );
-                                       $start = $ids[$numIds - 1] + 1;
+                                       $tableStart = $ids[$numIds - 1] + 1;
                                }
 
-                       } while ( $numIds >= $batchSize && ( $end === null || 
$start <= $end ) );
+                       } while ( $numIds >= $batchSize && ( $end === null || 
$tableStart <= $end ) );
 
                        $this->output( " deleted.\n" );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/229664
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I21678bc3c83946f2e62afe3fdc69c7e84678ceeb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_25
Gerrit-Owner: TTO <at.li...@live.com.au>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Nemo bis <federicol...@tiscali.it>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: PleaseStand <pleasest...@live.com>
Gerrit-Reviewer: TTO <at.li...@live.com.au>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to