(Bug 40860) make purgeRedundantText not fail on pre MW1.5 records
authorDévai Tamás <gonosztopi@gmail.com>
Tue, 15 Jan 2013 17:06:01 +0000 (13:06 -0400)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 22 Jan 2013 09:01:17 +0000 (09:01 +0000)
Archive records for deleted pages do not have an ar_text_id,
if they were deleted before big schema overhaul in MW 1.5.
This script was assuming all archive records had an ar_text_id.

Patch by Dévai Tamás.

Change-Id: I4776a8a0f29b8299ec6d27949dc53a96ece81f39

CREDITS
maintenance/Maintenance.php

diff --git a/CREDITS b/CREDITS
index ca5d6d7..a03ad5e 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -120,6 +120,7 @@ following names for their contribution to the product.
 * Daniel Werner
 * David Baumgarten
 * Denny Vrandecic
+* Dévai Tamás
 * Edward Z. Yang
 * Elvis Stansvik
 * Erwin Dokter
index b0371c0..45df0e9 100644 (file)
@@ -952,7 +952,10 @@ abstract class Maintenance {
                $this->output( 'Searching for active text records in archive table...' );
                $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" );
                foreach ( $res as $row ) {
-                       $cur[] = $row->ar_text_id;
+                       # old pre-MW 1.5 records can have null ar_text_id's.
+                       if ( $row->ar_text_id !== null ) {
+                               $cur[] = $row->ar_text_id;
+                       }
                }
                $this->output( "done.\n" );