mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Update Source.php
This commit is contained in:
@ -238,7 +238,7 @@ class Source {
|
|||||||
if ( $this->page === null ) {
|
if ( $this->page === null ) {
|
||||||
// Access the property directly to avoid an infinite loop.
|
// Access the property directly to avoid an infinite loop.
|
||||||
if ( $this->title != null) {
|
if ( $this->title != null) {
|
||||||
$this->page = static::getPageObject();
|
$this->page = static::getPageObject( $this->title );
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( 'Unable to create Page for this Source because Title is null.' );
|
throw new Exception( 'Unable to create Page for this Source because Title is null.' );
|
||||||
}
|
}
|
||||||
@ -249,14 +249,15 @@ class Source {
|
|||||||
/**
|
/**
|
||||||
* Obtain a WikiPage object.
|
* Obtain a WikiPage object.
|
||||||
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
|
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
|
||||||
|
* @param \Title $title
|
||||||
* @return WikiPage object
|
* @return WikiPage object
|
||||||
*/
|
*/
|
||||||
private static function getPageObject() {
|
private static function getPageObject( $title ) {
|
||||||
if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) {
|
if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) {
|
||||||
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
|
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
|
||||||
return $wikiPageFactory->newFromTitle( $this->title );
|
return $wikiPageFactory->newFromTitle( $title );
|
||||||
}
|
}
|
||||||
|
|
||||||
return \WikiPage::factory( $this->title );
|
return \WikiPage::factory( $title );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user