diff --git a/includes/EchoOnWikiList.php b/includes/EchoOnWikiList.php index 19dee29f7..adfbb8f2b 100644 --- a/includes/EchoOnWikiList.php +++ b/includes/EchoOnWikiList.php @@ -1,5 +1,7 @@ title->getArticleID() ); - if ( $article === null || !$article->exists() ) { + $article = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $this->title ); + if ( !$article->exists() ) { return []; } diff --git a/maintenance/generateSampleNotifications.php b/maintenance/generateSampleNotifications.php index 7f52ae263..f9dbbac7c 100644 --- a/maintenance/generateSampleNotifications.php +++ b/maintenance/generateSampleNotifications.php @@ -213,7 +213,7 @@ class GenerateSampleNotifications extends Maintenance { } private function addToPageContent( Title $title, User $agent, $contentText ) { - $page = WikiPage::factory( $title ); + $page = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $title ); $previousContent = ""; $page->loadPageData( WikiPage::READ_LATEST ); $revision = $page->getRevisionRecord(); @@ -271,7 +271,7 @@ class GenerateSampleNotifications extends Maintenance { // revert (undo) $moai = Title::newFromText( 'Moai' ); - $page = WikiPage::factory( $moai ); + $page = $services->getWikiPageFactory()->newFromTitle( $moai ); $this->output( "{$agent->getName()} is reverting {$user->getName()}'s edit on {$moai->getPrefixedText()}\n" ); $this->addToPageContent( $moai, $agent, "\ncreating a good revision here\n" ); $this->addToPageContent( $moai, $user, "\nadding a line here\n" ); diff --git a/tests/phpunit/DiscussionParserTest.php b/tests/phpunit/DiscussionParserTest.php index a2076ee93..c5a3474ce 100644 --- a/tests/phpunit/DiscussionParserTest.php +++ b/tests/phpunit/DiscussionParserTest.php @@ -948,8 +948,9 @@ TEXT $pages += [ $title => '' ]; $user = $this->getTestUser()->getUser(); + $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); foreach ( $pages as $pageTitle => $pageText ) { - $template = WikiPage::factory( Title::newFromText( $pageTitle ) ); + $template = $wikiPageFactory->newFromTitle( Title::newFromText( $pageTitle ) ); $template->doUserEditContent( new WikitextContent( $pageText ), $user, '' ); } diff --git a/tests/phpunit/ThankYouEditTest.php b/tests/phpunit/ThankYouEditTest.php index 3c2448dd8..a1bb01091 100644 --- a/tests/phpunit/ThankYouEditTest.php +++ b/tests/phpunit/ThankYouEditTest.php @@ -70,7 +70,7 @@ class MWEchoThankYouEditTest extends MediaWikiIntegrationTestCase { } private function edit( Title $title, User $user, $text ) { - $page = WikiPage::factory( $title ); + $page = $this->getServiceContainer()->getWikiPageFactory()->newFromTitle( $title ); $content = ContentHandler::makeContent( $text, $title ); $page->doUserEditContent( $content, $user, 'test' ); } diff --git a/tests/phpunit/UserLocatorTest.php b/tests/phpunit/UserLocatorTest.php index 04b9e21d0..4e2fa584b 100644 --- a/tests/phpunit/UserLocatorTest.php +++ b/tests/phpunit/UserLocatorTest.php @@ -108,7 +108,7 @@ class EchoUserLocatorTest extends MediaWikiIntegrationTestCase { */ public function testLocateArticleCreator( $message, $initialize ) { list( $expect, $title, $user ) = $initialize(); - WikiPage::factory( $title )->doUserEditContent( + $this->getServiceContainer()->getWikiPageFactory()->newFromTitle( $title )->doUserEditContent( /* $content = */ ContentHandler::makeContent( 'content', $title ), /* $user = */ $user, /* $summary = */ 'summary'