25 use InvalidArgumentException;
64 parent::__construct( $page, $slots,
$wikiId );
65 $this->mId = intval( $row->rev_id );
66 $this->mPageId = intval( $row->rev_page );
67 $this->mComment = $comment;
74 $this->mMinorEdit = boolval( $row->rev_minor_edit );
75 $this->mTimestamp = $timestamp;
76 $this->mDeleted = intval( $row->rev_deleted );
81 $this->mParentId = isset( $row->rev_parent_id ) ? intval( $row->rev_parent_id ) :
null;
82 $this->mSize = isset( $row->rev_len ) ? intval( $row->rev_len ) :
null;
83 $this->mSha1 = !empty( $row->rev_sha1 ) ? $row->rev_sha1 :
null;
89 if ( isset( $row->page_latest ) ) {
90 $this->mCurrent = ( $row->rev_id == $row->page_latest );
93 $pageIdBasedOnPage = $this->getArticleId( $this->mPage );
94 if ( $this->mPageId && $pageIdBasedOnPage && $this->mPageId !== $pageIdBasedOnPage ) {
95 throw new InvalidArgumentException(
96 'The given page (' . $this->mPage .
')' .
97 ' does not belong to page ID ' . $this->mPageId .
98 ' but actually belongs to ' . $this->getArticleId( $this->mPage )
118 if ( $this->
isCurrent() && $field === self::DELETED_TEXT ) {
125 return parent::isDeleted( $field );
129 if ( $this->
isCurrent() && $field === self::DELETED_TEXT ) {
136 return parent::userCan( $field, $performer );
145 return parent::getId(
$wikiId );
155 $this->mSize ??= $this->mSlots->computeSize();
167 $this->mSha1 ??= $this->mSlots->computeSha1();
191 return parent::getComment( $audience, $performer );
Interface for objects (potentially) representing an editable wiki page.