XML snapshots: when retrieving revision text, send the text id back to requester...
authorAriel Glenn <ariel@users.mediawiki.org>
Fri, 4 Jun 2010 02:24:56 +0000 (02:24 +0000)
committerAriel Glenn <ariel@users.mediawiki.org>
Fri, 4 Jun 2010 02:24:56 +0000 (02:24 +0000)
maintenance/dumpTextPass.php
maintenance/fetchText.php

index 86e00b0..931b445 100644 (file)
@@ -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;
index 809a1f2..55b64d2 100644 (file)
@@ -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 );
                }
        }