mirror of
				https://github.com/diocloid/LinkTitles.git
				synced 2025-10-22 05:42:32 +02:00 
			
		
		
		
	Merge pull request #71 from paladox/patch-1
Fix "Call to undefined method WikiPage::factory()"
This commit is contained in:
		@@ -26,6 +26,7 @@
 | 
				
			|||||||
namespace LinkTitles;
 | 
					namespace LinkTitles;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use CommentStoreComment;
 | 
					use CommentStoreComment;
 | 
				
			||||||
 | 
					use MediaWiki\MediaWikiServices;
 | 
				
			||||||
use MediaWiki\Revision\RenderedRevision;
 | 
					use MediaWiki\Revision\RenderedRevision;
 | 
				
			||||||
use MediaWiki\Revision\SlotRecord;
 | 
					use MediaWiki\Revision\SlotRecord;
 | 
				
			||||||
use Status;
 | 
					use Status;
 | 
				
			||||||
@@ -60,7 +61,13 @@ class Extension {
 | 
				
			|||||||
		$slots = $revision->getSlots();
 | 
							$slots = $revision->getSlots();
 | 
				
			||||||
		$content = $slots->getContent( SlotRecord::MAIN );
 | 
							$content = $slots->getContent( SlotRecord::MAIN );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$wikiPage = WikiPage::factory( $title );
 | 
							// MW 1.36+
 | 
				
			||||||
 | 
							if ( method_exists( MediaWikiServices::class, 'getWikiPageFactory' ) ) {
 | 
				
			||||||
 | 
								$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
 | 
				
			||||||
 | 
								$wikiPage = $wikiPageFactory->newFromTitle( $title );
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								$wikiPage = WikiPage::factory( $title );
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$source = Source::createFromPageandContent( $wikiPage, $content, $config );
 | 
							$source = Source::createFromPageandContent( $wikiPage, $content, $config );
 | 
				
			||||||
		$linker = new Linker( $config );
 | 
							$linker = new Linker( $config );
 | 
				
			||||||
		$result = $linker->linkContent( $source );
 | 
							$result = $linker->linkContent( $source );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user