const DELETED_COMMENT = 2;
const DELETED_USER = 4;
const DELETED_RESTRICTED = 8;
- const DELETED_NAME = 16;
/**
* Load a page revision from a given revision ID number.
$this->mMinorEdit = isset( $row['minor_edit'] ) ? intval( $row['minor_edit'] ) : 0;
$this->mTimestamp = isset( $row['timestamp'] ) ? strval( $row['timestamp'] ) : wfTimestamp( TS_MW );
$this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0;
-
+ $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : 0;
+
// Enforce spacing trimming on supplied text
$this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null;
$this->mText = isset( $row['text'] ) ? rtrim( strval( $row['text'] ) ) : null;
$this->mTitle = null; # Load on demand if needed
$this->mCurrent = false;
-
- $this->mSize = is_null($this->mText) ? null : strlen($this->mText);
+ # If we still have no len_size, see it we have the text to figure it out
+ if ( !$this->mSize )
+ $this->mSize = is_null($this->mText) ? null : strlen($this->mText);
} else {
throw new MWException( 'Revision constructor passed invalid row format.' );
}
'rev_user_text' => $this->mUserText,
'rev_timestamp' => $dbw->timestamp( $this->mTimestamp ),
'rev_deleted' => $this->mDeleted,
- 'rev_len' => strlen($this->mText),
+ 'rev_len' => ( $this->mSize ) ? $this->mSize : strlen($this->mText),
), $fname
);
function listRevisions() {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'archive',
- array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment' ),
+ array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment', 'ar_len' ),
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey() ),
'PageArchive::listRevisions',
'ar_timestamp',
'ar_minor_edit',
'ar_flags',
- 'ar_text_id' ),
+ 'ar_text_id',
+ 'ar_len' ),
array( 'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDbkey(),
'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
'ar_timestamp',
'ar_minor_edit',
'ar_flags',
- 'ar_text_id' ),
+ 'ar_text_id',
+ 'ar_len' ),
/* WHERE */ array(
'ar_namespace' => $this->title->getNamespace(),
'ar_title' => $this->title->getDBkey(),
'timestamp' => $row->ar_timestamp,
'minor_edit' => $row->ar_minor_edit,
'text_id' => $row->ar_text_id,
+ 'len' => $row->ar_len
) );
$revision->insertOn( $dbw );
$restored++;
$pageLink = $wgLang->timeanddate( $ts, true );
}
$userLink = $sk->userLink( $row->ar_user, $row->ar_user_text ) . $sk->userToolLinks( $row->ar_user, $row->ar_user_text );
+ if (!is_null($size = $row->ar_len)) {
+ if ($size == 0)
+ $stxt = wfMsgHtml('historyempty');
+ else
+ $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
+ }
$comment = $sk->commentBlock( $row->ar_comment );
- $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
+ $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" );
}
$revisions->free();