26 use InvalidArgumentException;
30 use Wikimedia\Assert\Assert;
64 parent::__construct(
$title, $slots, $dbDomain );
65 Assert::parameterType(
'object', $row,
'$row' );
67 $this->mId = intval( $row->rev_id );
68 $this->mPageId = intval( $row->rev_page );
69 $this->mComment = $comment;
71 $timestamp =
wfTimestamp( TS_MW, $row->rev_timestamp );
72 Assert::parameter( is_string( $timestamp ),
'$row->rev_timestamp',
'must be a valid timestamp' );
75 $this->mMinorEdit = boolval( $row->rev_minor_edit );
76 $this->mTimestamp = $timestamp;
77 $this->mDeleted = intval( $row->rev_deleted );
82 $this->mParentId = isset( $row->rev_parent_id ) ? intval( $row->rev_parent_id ) :
null;
83 $this->mSize = isset( $row->rev_len ) ? intval( $row->rev_len ) :
null;
84 $this->mSha1 = !empty( $row->rev_sha1 ) ? $row->rev_sha1 :
null;
90 if ( isset( $row->page_latest ) ) {
91 $this->mCurrent = ( $row->rev_id == $row->page_latest );
96 $this->mPageId && $this->mTitle->exists()
97 && $this->mPageId !== $this->mTitle->getArticleID()
99 throw new InvalidArgumentException(
100 'The given Title does not belong to page ID ' . $this->mPageId .
101 ' but actually belongs to ' . $this->mTitle->getArticleID()
123 if ( $this->
isCurrent() && $field === self::DELETED_TEXT ) {
130 return parent::isDeleted( $field );
134 if ( $this->
isCurrent() && $field === self::DELETED_TEXT ) {
141 return parent::userCan( $field, $user );
149 return parent::getId();
159 if ( $this->mSize ===
null ) {
160 $this->mSize = $this->mSlots->computeSize();
173 if ( $this->mSha1 ===
null ) {
174 $this->mSha1 = $this->mSlots->computeSha1();
186 public function getUser( $audience = self::FOR_PUBLIC,
User $user =
null ) {
199 return parent::getComment( $audience, $user );
225 class_alias( RevisionStoreRecord::class,
'MediaWiki\Storage\RevisionStoreRecord' );