Fix duplicate getPage functions in Source

Causing a fatal.
This commit is contained in:
paladox
2023-12-27 23:44:13 +00:00
committed by GitHub
parent 573cc2e15c
commit b5e4e0758c

View File

@ -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::getPage(); $this->page = static::getPageObject();
} 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.' );
} }
@ -251,7 +251,7 @@ class Source {
* Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory. * Workaround for MediaWiki 1.36+ which deprecated Wikipage::factory.
* @return WikiPage object * @return WikiPage object
*/ */
private static function getPage() { private static function getPageObject() {
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( $this->title );