Use WikiPageFactory to create WikiPage object

Bug: T297688
Change-Id: I5e6da574bd1377b492005adbc1aff3e97fe9c31b
This commit is contained in:
Umherirrender 2022-06-24 19:46:15 +02:00
parent 11cde1c520
commit 560819e270

View file

@ -20,7 +20,6 @@ use RequestContext;
use ResourceLoader;
use Status;
use Title;
use WikiPage;
/**
* Hooks for TemplateData extension
@ -259,6 +258,7 @@ class Hooks {
$tplData = [];
$pageProps = MediaWikiServices::getInstance()->getPageProps();
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
// This inefficient implementation is currently tuned for
// Parsoid's use case where it requests info for exactly one title.
@ -272,7 +272,7 @@ class Hooks {
}
if ( $title->isRedirect() ) {
$title = ( new WikiPage( $title ) )->getRedirectTarget();
$title = $wikiPageFactory->newFromTitle( $title )->getRedirectTarget();
if ( !$title ) {
// Invalid redirecting title
$tplData[$tplTitle] = null;