2007-11-20 12:58:34 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Communications protocol...
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Maintenance
|
2007-11-20 12:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
2009-06-24 02:02:37 +00:00
|
|
|
require_once( "Maintenance.php" );
|
2007-11-20 12:58:34 +00:00
|
|
|
|
2009-06-24 02:02:37 +00:00
|
|
|
class FetchText extends Maintenance {
|
|
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->mDescription = "Fetch the revision text from an old_id";
|
2008-05-19 15:49:05 +00:00
|
|
|
}
|
2007-11-20 12:58:34 +00:00
|
|
|
|
2009-06-24 02:02:37 +00:00
|
|
|
public function execute() {
|
|
|
|
|
$db = wfGetDB( DB_SLAVE );
|
|
|
|
|
$stdin = $this->getStdin();
|
|
|
|
|
while( !feof( $stdin ) ) {
|
|
|
|
|
$line = fgets( $stdin );
|
|
|
|
|
if( $line === false ) {
|
|
|
|
|
// We appear to have lost contact...
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$textId = intval( $line );
|
|
|
|
|
$text = $this->doGetText( $db, $textId );
|
|
|
|
|
$this->output( strlen( $text ) . "\n". $text );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* May throw a database error if, say, the server dies during query.
|
|
|
|
|
* @param $db Database object
|
|
|
|
|
* @param $id int The old_id
|
|
|
|
|
* @return String
|
|
|
|
|
*/
|
|
|
|
|
private 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;
|
2007-11-20 12:58:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-06-24 02:02:37 +00:00
|
|
|
|
|
|
|
|
$maintClass = "FetchText";
|
|
|
|
|
require_once( DO_MAINTENANCE );
|