summaryrefslogtreecommitdiff
path: root/maintenance/fetchText.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
committerPierre Schmitz <pierre@archlinux.de>2008-03-21 11:49:34 +0100
commit086ae52d12011746a75f5588e877347bc0457352 (patch)
treee73263c7a29d0f94fafb874562610e16eb292ba8 /maintenance/fetchText.php
parent749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff)
Update auf MediaWiki 1.12.0
Diffstat (limited to 'maintenance/fetchText.php')
-rw-r--r--maintenance/fetchText.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/maintenance/fetchText.php b/maintenance/fetchText.php
new file mode 100644
index 00000000..3b745c0a
--- /dev/null
+++ b/maintenance/fetchText.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Communications protocol...
+ */
+
+require "commandLine.inc";
+
+$db = wfGetDB( DB_SLAVE );
+$stdin = fopen( "php://stdin", "rt" );
+while( !feof( $stdin ) ) {
+ $line = fgets( $stdin );
+ $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;
+}
+
+
+?> \ No newline at end of file