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->getRelativeHistoryLink( $title, $timestamp );
return $this->canUseWikiPage() && $this->getWikiPage()->exists() ?
$historyLink + $historyIconClasses : null;
$title = $this->getTitle();
return $title->canExist() && $title->exists()
? $historyLink + $historyIconClasses
: null;
}
/**
@ -596,12 +598,16 @@ class SkinMinerva extends SkinMustache {
], $addTopicButton['label'] );
}
if ( $this->isSimplifiedTalkPageEnabled() && $this->canUseWikiPage() ) {
$wikiPage = $this->getWikiPage();
$parserOptions = $wikiPage->makeParserOptions( $this->getContext() );
$parserOutput = $wikiPage->getParserOutput( $parserOptions );
$sectionCount = $parserOutput ? count( $parserOutput->getSections() ) : 0;
$title = $this->getTitle();
if ( $this->isSimplifiedTalkPageEnabled() && $title->canExist() ) {
$parserOutputAccess = MediaWikiServices::getInstance()->getParserOutputAccess();
$parserOptions = ParserOptions::newFromContext( $this->getContext() );
$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' )
: wfMessage( 'minerva-talk-explained-empty' );
$html .= Html::element( 'div', [ 'class' =>