blob: 91b78be3fe052aeb604e137c6ffee2c5e77a245d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
/**
* Communications protocol...
*
* @file
* @ingroup Maintenance
*/
require "commandLine.inc";
$db = wfGetDB( DB_SLAVE );
$stdin = fopen( "php://stdin", "rt" );
while( !feof( $stdin ) ) {
$line = fgets( $stdin );
if( $line === false ) {
// We appear to have lost contact...
break;
}
$textId = intval( $line );
$text = doGetText( $db, $textId );
echo strlen( $text ) . "\n";
echo $text;
}
/**
* May throw a database error if, say, the server dies during query.
*/
function doGetText( $db, $id ) {
$id = intval( $id );
$row = $db->selectRow( 'text',
array( 'old_text', 'old_flags' ),
array( 'old_id' => $id ),
'TextPassDumper::getText' );
$text = Revision::getRevisionText( $row );
if( $text === false ) {
return false;
}
return $text;
}
|