27use InvalidArgumentException;
32use Wikimedia\Assert\Assert;
54 $title = Title::newFromLinkTarget(
$parent->getPageAsLinkTarget() );
57 foreach (
$parent->getSlotRoles() as $role ) {
58 $slot =
$parent->getSlot( $role, self::RAW );
59 $rev->inheritSlot( $slot );
81 parent::__construct( $title, $slots, $wikiId );
83 $this->mSlots = $slots;
90 Assert::parameterType(
'integer', $parentId,
'$parentId' );
92 $this->mParentId = $parentId;
112 throw new InvalidArgumentException(
113 'The given slot must be an unsaved, unattached one. '
114 .
'This slot is already attached to revision ' . $slot->
getRevision() .
'. '
115 .
'Use inheritSlot() instead to preserve a slot from a previous revision.'
119 $this->mSlots->setSlot( $slot );
133 $this->mSlots->inheritSlot( $parentSlot );
152 $this->mSlots->setContent( $role,
$content );
169 $this->mSlots->removeSlot( $role );
179 $update->apply( $this->mSlots );
186 $this->mComment = $comment;
199 Assert::parameterType(
'string', $sha1,
'$sha1' );
201 $this->mSha1 = $sha1;
214 Assert::parameterType(
'integer', $size,
'$size' );
216 $this->mSize = $size;
223 Assert::parameterType(
'integer', $visibility,
'$visibility' );
225 $this->mDeleted = $visibility;
232 Assert::parameterType(
'string', $timestamp,
'$timestamp' );
234 $this->mTimestamp =
wfTimestamp( TS_MW, $timestamp );
241 Assert::parameterType(
'boolean', $minorEdit,
'$minorEdit' );
243 $this->mMinorEdit = $minorEdit;
258 Assert::parameterType(
'integer', $id,
'$id' );
269 $this->mUser =
$user;
276 Assert::parameterType(
'integer', $pageId,
'$pageId' );
278 if ( $this->mTitle->exists() && $pageId !== $this->mTitle->getArticleID() ) {
279 throw new InvalidArgumentException(
280 'The given Title does not belong to page ID ' . $this->mPageId
284 $this->mPageId = $pageId;
296 if ( $this->mSize ===
null ) {
297 $this->mSize = $this->mSlots->computeSize();
312 if ( $this->mSha1 ===
null ) {
313 $this->mSha1 = $this->mSlots->computeSha1();
327 return parent::getSlots();
344class_alias( MutableRevisionRecord::class,
'MediaWiki\Storage\MutableRevisionRecord' );
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Represents a title within MediaWiki.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Base interface for content objects.