From a2b7c4fb8527ec1e84f10617782315442a916f63 Mon Sep 17 00:00:00 2001 From: Ariel Glenn Date: Fri, 4 Jun 2010 02:24:56 +0000 Subject: [PATCH] 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 --- maintenance/dumpTextPass.php | 12 +++++++++++- maintenance/fetchText.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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 ); } } -- 2.20.1