* @return string
*/
function getRevisionText( $timestamp ) {
+ $fname = 'PageArchive::getRevisionText';
$dbr =& wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'archive',
- array( 'ar_text', 'ar_flags' ),
+ array( 'ar_text', 'ar_flags', 'ar_text_id' ),
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDbkey(),
- 'ar_timestamp' => $dbr->timestamp( $timestamp ) ) );
- return Revision::getRevisionText( $row, "ar_" );
+ 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
+ $fname );
+ if( is_null( $row->ar_text_id ) ) {
+ // An old row from MediaWiki 1.4 or previous.
+ // Text is embedded in this row in classic compression format.
+ return Revision::getRevisionText( $row, "ar_" );
+ } else {
+ // New-style: keyed to the text storage backend.
+ $text = $dbr->selectRow( 'text',
+ array( 'old_text', 'old_flags' ),
+ array( 'old_id' => $row->ar_text_id ),
+ $fname );
+ return Revision::getRevisionText( $text );
+ }
}
/**
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ),
'PageArchive::getLastRevisionText',
- array( 'ORDER BY' => 'ar_timestamp DESC',
- 'LIMIT' => '1' ) );
+ array( 'ORDER BY' => 'ar_timestamp DESC' ) );
if( $row ) {
return Revision::getRevisionText( $row, "ar_" );
} else {
'ar_user_text',
'ar_timestamp',
'ar_minor_edit',
- 'ar_flags' ),
+ 'ar_flags',
+ 'ar_text_id' ),
/* WHERE */ array(
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
'user_text' => $row->ar_user_text,
'timestamp' => $row->ar_timestamp,
'minor_edit' => $row->ar_minor_edit,
+ 'text_id' => $row->ar_text_id,
) );
$revision->insertOn( $dbw );
}
# Touch the log!
$log = new LogPage( 'delete' );
if( $restoreAll ) {
- $reason = "";
+ $reason = '';
} else {
- $reason = wfMsg( 'undeletedrevisions', $restoreRevisions );
+ $reason = wfMsgForContent( 'undeletedrevisions', $restoreRevisions );
}
$log->addEntry( 'restore', $this->title, $reason );
if (NS_IMAGE == $this->mTargetObj->getNamespace()) {
/* refresh image metadata cache */
- new Image( $this->mTargetObj->getText(), true );
+ new Image( $this->mTargetObj );
}
return true;