f300318e373f6cad52936c0f9927bf24d385dbbc
3 * Communications protocol...
9 require_once( "Maintenance.php" );
11 class FetchText
extends Maintenance
{
12 public function __construct() {
13 parent
::__construct();
14 $this->mDescription
= "Fetch the revision text from an old_id";
17 public function execute() {
18 $db = wfGetDB( DB_SLAVE
);
19 $stdin = $this->getStdin();
20 while( !feof( $stdin ) ) {
21 $line = fgets( $stdin );
22 if( $line === false ) {
23 // We appear to have lost contact...
26 $textId = intval( $line );
27 $text = $this->doGetText( $db, $textId );
28 $this->output( strlen( $text ) . "\n". $text );
33 * May throw a database error if, say, the server dies during query.
34 * @param $db Database object
35 * @param $id int The old_id
38 private function doGetText( $db, $id ) {
40 $row = $db->selectRow( 'text',
41 array( 'old_text', 'old_flags' ),
42 array( 'old_id' => $id ),
43 'TextPassDumper::getText' );
44 $text = Revision
::getRevisionText( $row );
45 if( $text === false ) {
52 $maintClass = "FetchText";
53 require_once( DO_MAINTENANCE
);