mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Fix "Call to undefined method WikiPage::factory()"
This commit is contained in:
@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace LinkTitles;
|
namespace LinkTitles;
|
||||||
|
|
||||||
|
use MediaWiki\MediaWikiServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a page that is a potential link target.
|
* Represents a page that is a potential link target.
|
||||||
*/
|
*/
|
||||||
@ -189,7 +191,13 @@ class Target {
|
|||||||
*/
|
*/
|
||||||
public function getContent() {
|
public function getContent() {
|
||||||
if ( $this->content === null ) {
|
if ( $this->content === null ) {
|
||||||
$this->content = \WikiPage::factory( $this->title )->getContent();
|
// MW 1.36+
|
||||||
|
if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) {
|
||||||
|
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
|
||||||
|
$this->content = $wikiPageFactory->newFromTitle( $this->title )->getContent();
|
||||||
|
} else {
|
||||||
|
$this->content = WikiPage::factory( $this->title );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user