Replace usage of the methods IContextSource::getWikiPage & canUseWikiPage that will be deprecated to WikiPageFactory usage

Bug: T275710
Change-Id: Ia5cff18a6d9417d8e6960f2d20f7b41174f97341
This commit is contained in:
Roman Stolar 2021-11-17 17:09:30 +02:00
parent d6753edfe8
commit a0e560ffe6

View file

@ -459,8 +459,10 @@ class SkinMinerva extends SkinMustache {
$this->getGenericHistoryLink( $title ) : $this->getGenericHistoryLink( $title ) :
$this->getRelativeHistoryLink( $title, $timestamp ); $this->getRelativeHistoryLink( $title, $timestamp );
return $this->canUseWikiPage() && $this->getWikiPage()->exists() ? $title = $this->getTitle();
$historyLink + $historyIconClasses : null; return $title->canExist() && $title->exists()
? $historyLink + $historyIconClasses
: null;
} }
/** /**
@ -596,12 +598,16 @@ class SkinMinerva extends SkinMustache {
], $addTopicButton['label'] ); ], $addTopicButton['label'] );
} }
if ( $this->isSimplifiedTalkPageEnabled() && $this->canUseWikiPage() ) { $title = $this->getTitle();
$wikiPage = $this->getWikiPage(); if ( $this->isSimplifiedTalkPageEnabled() && $title->canExist() ) {
$parserOptions = $wikiPage->makeParserOptions( $this->getContext() ); $parserOutputAccess = MediaWikiServices::getInstance()->getParserOutputAccess();
$parserOutput = $wikiPage->getParserOutput( $parserOptions ); $parserOptions = ParserOptions::newFromContext( $this->getContext() );
$sectionCount = $parserOutput ? count( $parserOutput->getSections() ) : 0; $pageRecord = $title->toPageRecord();
$status = $parserOutputAccess->getParserOutput( $pageRecord, $parserOptions );
$statusValue = $status->getValue();
$sectionCount = ( $status->isGood() && $statusValue instanceof ParserOutput )
? count( $statusValue->getSections() )
: 0;
$message = $sectionCount > 0 ? wfMessage( 'minerva-talk-explained' ) $message = $sectionCount > 0 ? wfMessage( 'minerva-talk-explained' )
: wfMessage( 'minerva-talk-explained-empty' ); : wfMessage( 'minerva-talk-explained-empty' );
$html .= Html::element( 'div', [ 'class' => $html .= Html::element( 'div', [ 'class' =>