X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStorage%2FMutableRevisionRecord.php;h=1aa1165d9978c600fcaa83e5ed5b0f25e85d0343;hb=6cfdbdf60e69cce31d2f28f0a0e7e478785fe886;hp=a259ae0bf790885252471fc94724f6bb0f509716;hpb=08edb27f6ce31c676660a4ef89b87da79bde2cc2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Storage/MutableRevisionRecord.php b/includes/Storage/MutableRevisionRecord.php index a259ae0bf7..1aa1165d99 100644 --- a/includes/Storage/MutableRevisionRecord.php +++ b/includes/Storage/MutableRevisionRecord.php @@ -44,26 +44,14 @@ class MutableRevisionRecord extends RevisionRecord { * the new revision will act as a null-revision. * * @param RevisionRecord $parent - * @param CommentStoreComment $comment - * @param UserIdentity $user - * @param string $timestamp * * @return MutableRevisionRecord */ - public static function newFromParentRevision( - RevisionRecord $parent, - CommentStoreComment $comment, - UserIdentity $user, - $timestamp - ) { + public static function newFromParentRevision( RevisionRecord $parent ) { // TODO: ideally, we wouldn't need a Title here $title = Title::newFromLinkTarget( $parent->getPageAsLinkTarget() ); $rev = new MutableRevisionRecord( $title, $parent->getWikiId() ); - $rev->setComment( $comment ); - $rev->setUser( $user ); - $rev->setTimestamp( $timestamp ); - foreach ( $parent->getSlotRoles() as $role ) { $slot = $parent->getSlot( $role, self::RAW ); $rev->inheritSlot( $slot ); @@ -140,8 +128,8 @@ class MutableRevisionRecord extends RevisionRecord { * @param SlotRecord $parentSlot */ public function inheritSlot( SlotRecord $parentSlot ) { - $slot = SlotRecord::newInherited( $parentSlot ); - $this->setSlot( $slot ); + $this->mSlots->inheritSlot( $parentSlot ); + $this->resetAggregateValues(); } /** @@ -180,6 +168,15 @@ class MutableRevisionRecord extends RevisionRecord { $this->resetAggregateValues(); } + /** + * Applies the given update to the slots of this revision. + * + * @param RevisionSlotsUpdate $update + */ + public function applyUpdate( RevisionSlotsUpdate $update ) { + $update->apply( $this->mSlots ); + } + /** * @param CommentStoreComment $comment */