From 36ba33c394ce2983fe84af061e94460484477773 Mon Sep 17 00:00:00 2001 From: Ariel Glenn Date: Fri, 4 Jun 2010 03:10:34 +0000 Subject: [PATCH] XML snapshots: check length of revision text from prefetched content against length in db before using, partial fix for bugs 23264, 18694 --- maintenance/dumpTextPass.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 931b44513a..f83ab1a13d 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -188,8 +188,15 @@ class TextPassDumper extends BackupDumper { // Blank entries may indicate that the prior dump was broken. // To be safe, reload it. } else { - $this->prefetchCount++; - return $text; + $dbr = wfGetDB( DB_SLAVE ); + $revID = intval($this->thisRev); + $revLength = $dbr->selectField( 'revision', 'rev_len', array('rev_id' => $revID ) ); + // if length of rev text in file doesn't match length in db, we reload + // this avoids carrying forward broken data from previous xml dumps + if( strlen($text) == $revLength ) { + $this->prefetchCount++; + return $text; + } } } return $this->doGetText( $id ); -- 2.20.1