From: Ariel Glenn Date: Fri, 4 Jun 2010 02:24:56 +0000 (+0000) Subject: XML snapshots: when retrieving revision text, send the text id back to requester... X-Git-Tag: 1.31.0-rc.0~36620 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a2b7c4fb8527ec1e84f10617782315442a916f63;p=lhc%2Fweb%2Fwiklou.git XML snapshots: when retrieving revision text, send the text id back to requester for doublechecking (avoids revision text out of sync errors), partial fix for bugs 23264, 18694 --- diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 86e00b0c9b..931b44513a 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -331,7 +331,17 @@ class TextPassDumper extends BackupDumper { $ok = fflush( $this->spawnWrite ); // $this->progress( ">> [flush]" ); if ( !$ok ) return false; - + + // check that the text id they are sending is the one we asked for + // this avoids out of sync revision text errors we have encountered in the past + $newId = fgets( $this->spawnRead ); + if ( $newId === false ) { + return false; + } + if ( $id != intval( $newId ) ) { + return false; + } + $len = fgets( $this->spawnRead ); // $this->progress( "<< " . trim( $len ) ); if ( $len === false ) return false; diff --git a/maintenance/fetchText.php b/maintenance/fetchText.php index 809a1f2670..55b64d2f10 100644 --- a/maintenance/fetchText.php +++ b/maintenance/fetchText.php @@ -39,7 +39,7 @@ class FetchText extends Maintenance { } $textId = intval( $line ); $text = $this->doGetText( $db, $textId ); - $this->output( strlen( $text ) . "\n" . $text ); + $this->output( $textId . "\n" . strlen( $text ) . "\n" . $text ); } }