parent::__construct( $title, $slots, $wikiId );
Assert::parameterType( 'object', $row, '$row' );
+ $timestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
+ Assert::parameter( is_string( $timestamp ), '$row->rev_timestamp', 'must be a valid timestamp' );
+
$this->mArchiveId = intval( $row->ar_id );
// NOTE: ar_page_id may be different from $this->mTitle->getArticleID() in some cases,
$this->mId = isset( $row->ar_rev_id ) ? intval( $row->ar_rev_id ) : null;
$this->mComment = $comment;
$this->mUser = $user;
- $this->mTimestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
+ $this->mTimestamp = $timestamp;
$this->mMinorEdit = boolval( $row->ar_minor_edit );
$this->mDeleted = intval( $row->ar_deleted );
- $this->mSize = intval( $row->ar_len );
- $this->mSha1 = isset( $row->ar_sha1 ) ? $row->ar_sha1 : null;
+ $this->mSize = isset( $row->ar_len ) ? intval( $row->ar_len ) : null;
+ $this->mSha1 = !empty( $row->ar_sha1 ) ? $row->ar_sha1 : null;
}
/**
* @return int
*/
public function getArchiveId() {
- return $this->mId;
+ return $this->mArchiveId;
}
/**
}
/**
+ * @throws RevisionAccessException if the size was unknown and could not be calculated.
* @return int The nominal revision size, never null. May be computed on the fly.
*/
public function getSize() {
}
/**
+ * @throws RevisionAccessException if the hash was unknown and could not be calculated.
* @return string The revision hash, never null. May be computed on the fly.
*/
public function getSha1() {