mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Update Target.php
This commit is contained in:
@ -191,7 +191,7 @@ class Target {
|
||||
*/
|
||||
public function getContent() {
|
||||
if ( $this->content === null ) {
|
||||
$this->content = static::getPage();
|
||||
$this->content = static::getPageContents( $this->title );
|
||||
};
|
||||
return $this->content;
|
||||
}
|
||||
@ -248,14 +248,15 @@ class Target {
|
||||
/**
|
||||
* Obtain a page's content.
|
||||
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
|
||||
* @param \Title $title
|
||||
* @return Content content object of the page
|
||||
*/
|
||||
private static function getPage() {
|
||||
private static function getPageContents( $title ) {
|
||||
if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) {
|
||||
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
|
||||
$page = $wikiPageFactory->newFromTitle( $this->title );
|
||||
$page = $wikiPageFactory->newFromTitle( $title );
|
||||
} else {
|
||||
$page = \WikiPage::factory( $this->title );
|
||||
$page = \WikiPage::factory( $title );
|
||||
}
|
||||
return $page->getContent();
|
||||
}
|
||||
|
Reference in New Issue
Block a user