EditPage::edit - remove use of Revision objects

Remove use of ::newFromId, ::getPrevious, and ::getContentModel

Bug: T251073
Bug: T250981
Bug: T249021
Change-Id: I634b371d20cdf1a42ca3be77550717884f988d23
This commit is contained in:
DannyS712 2020-05-27 23:24:24 +00:00
parent d535ebeb51
commit 68ca964f56

View file

@ -692,12 +692,22 @@ class EditPage {
if ( $revContentModel && $revContentModel !== $this->contentModel ) {
$prevRev = null;
if ( $this->undidRev ) {
$undidRevObj = Revision::newFromId( $this->undidRev );
$prevRev = $undidRevObj ? $undidRevObj->getPrevious() : null;
$undidRevRecord = $this->revisionStore
->getRevisionById( $this->undidRev );
$prevRevRecord = $undidRevRecord ?
$this->revisionStore->getPreviousRevision( $undidRevRecord ) :
null;
$prevContentModel = $prevRevRecord ?
$prevRevRecord
->getSlot( SlotRecord::MAIN, RevisionRecord::RAW )
->getModel() :
'';
}
if ( !$this->undidRev
|| !$prevRev
|| $prevRev->getContentModel() !== $this->contentModel
|| !$prevRevRecord
|| $prevContentModel !== $this->contentModel
) {
$this->displayViewSourcePage(
$this->getContentObject(),