27use InvalidArgumentException;
31use Wikimedia\Assert\Assert;
63 $rev->setComment( $comment );
64 $rev->setUser( $user );
65 $rev->setTimestamp( $timestamp );
68 $slot = $parent->
getSlot( $role, self::RAW );
69 $rev->inheritSlot( $slot );
91 parent::__construct( $title, $slots, $wikiId );
93 $this->mSlots = $slots;
100 Assert::parameterType(
'integer', $parentId,
'$parentId' );
102 $this->mParentId = $parentId;
122 throw new InvalidArgumentException(
123 'The given slot must be an unsaved, unattached one. '
124 .
'This slot is already attached to revision ' . $slot->
getRevision() .
'. '
125 .
'Use inheritSlot() instead to preserve a slot from a previous revision.'
129 $this->mSlots->setSlot( $slot );
162 $this->mSlots->setContent( $role, $content );
179 $this->mSlots->removeSlot( $role );
187 $this->mComment = $comment;
200 Assert::parameterType(
'string', $sha1,
'$sha1' );
202 $this->mSha1 = $sha1;
215 Assert::parameterType(
'integer', $size,
'$size' );
217 $this->mSize = $size;
224 Assert::parameterType(
'integer', $visibility,
'$visibility' );
226 $this->mDeleted = $visibility;
233 Assert::parameterType(
'string', $timestamp,
'$timestamp' );
235 $this->mTimestamp =
wfTimestamp( TS_MW, $timestamp );
242 Assert::parameterType(
'boolean', $minorEdit,
'$minorEdit' );
244 $this->mMinorEdit = $minorEdit;
259 Assert::parameterType(
'integer', $id,
'$id' );
270 $this->mUser =
$user;
277 Assert::parameterType(
'integer', $pageId,
'$pageId' );
279 if ( $this->mTitle->exists() && $pageId !== $this->mTitle->getArticleID() ) {
280 throw new InvalidArgumentException(
281 'The given Title does not belong to page ID ' . $this->mPageId
285 $this->mPageId = $pageId;
297 if ( $this->mSize ===
null ) {
298 $this->mSize = $this->mSlots->computeSize();
313 if ( $this->mSha1 ===
null ) {
314 $this->mSha1 = $this->mSlots->computeSha1();
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.