From: Ariel Glenn Date: Fri, 4 Jun 2010 03:10:34 +0000 (+0000) Subject: XML snapshots: check length of revision text from prefetched content against length... X-Git-Tag: 1.31.0-rc.0~36619 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=36ba33c394ce2983fe84af061e94460484477773;p=lhc%2Fweb%2Fwiklou.git XML snapshots: check length of revision text from prefetched content against length in db before using, partial fix for bugs 23264, 18694 --- 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 );