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