Go to the documentation of this file.
27 use InvalidArgumentException;
33 use Wikimedia\Assert\Assert;
62 $slot = $parent->
getSlot( $role, self::RAW );
63 $rev->inheritSlot( $slot );
67 $rev->setParentId( $parent->
getId() );
88 parent::__construct(
$title, $slots, $dbDomain );
96 Assert::parameterType(
'integer', $parentId,
'$parentId' );
98 $this->mParentId = $parentId;
121 throw new InvalidArgumentException(
122 'The given slot must be an unsaved, unattached one. '
123 .
'This slot is already attached to revision ' . $slot->
getRevision() .
'. '
124 .
'Use inheritSlot() instead to preserve a slot from a previous revision.'
128 $this->mSlots->setSlot( $slot );
144 $this->mSlots->inheritSlot( $parentSlot );
165 $this->mSlots->setContent( $role,
$content );
184 $this->mSlots->removeSlot( $role );
196 $update->apply( $this->mSlots );
206 $this->mComment = $comment;
222 Assert::parameterType(
'string', $sha1,
'$sha1' );
224 $this->mSha1 = $sha1;
240 Assert::parameterType(
'integer', $size,
'$size' );
242 $this->mSize = $size;
252 Assert::parameterType(
'integer', $visibility,
'$visibility' );
254 $this->mDeleted = $visibility;
264 Assert::parameterType(
'string', $timestamp,
'$timestamp' );
266 $this->mTimestamp = MWTimestamp::convert( TS_MW, $timestamp );
276 Assert::parameterType(
'boolean', $minorEdit,
'$minorEdit' );
278 $this->mMinorEdit = $minorEdit;
296 Assert::parameterType(
'integer', $id,
'$id' );
309 public function setUser( UserIdentity $user ) {
310 $this->mUser = $user;
320 Assert::parameterType(
'integer', $pageId,
'$pageId' );
322 if ( $this->mTitle->exists() && $pageId !== $this->mTitle->getArticleID() ) {
323 throw new InvalidArgumentException(
324 'The given Title does not belong to page ID ' . $this->mPageId
328 $this->mPageId = $pageId;
342 if ( $this->mSize ===
null ) {
343 $this->mSize = $this->mSlots->computeSize();
358 if ( $this->mSha1 ===
null ) {
359 $this->mSha1 = $this->mSlots->computeSha1();
373 return parent::getSlots();
391 class_alias( MutableRevisionRecord::class,
'MediaWiki\Storage\MutableRevisionRecord' );
Library for creating and parsing MW-style timestamps.
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Base interface for content objects.
Represents a title within MediaWiki.