00001 <?php
00009 require "commandLine.inc";
00010
00011 $db = wfGetDB( DB_SLAVE );
00012 $stdin = fopen( "php://stdin", "rt" );
00013 while( !feof( $stdin ) ) {
00014 $line = fgets( $stdin );
00015 if( $line === false ) {
00016
00017 break;
00018 }
00019 $textId = intval( $line );
00020 $text = doGetText( $db, $textId );
00021 echo strlen( $text ) . "\n";
00022 echo $text;
00023 }
00024
00028 function doGetText( $db, $id ) {
00029 $id = intval( $id );
00030 $row = $db->selectRow( 'text',
00031 array( 'old_text', 'old_flags' ),
00032 array( 'old_id' => $id ),
00033 'TextPassDumper::getText' );
00034 $text = Revision::getRevisionText( $row );
00035 if( $text === false ) {
00036 return false;
00037 }
00038 return $text;
00039 }