Merge "Use WikiPage::doUserEditContent() instead of ::doEditContent()"

This commit is contained in:
jenkins-bot 2021-06-28 14:06:34 +00:00 committed by Gerrit Code Review
commit 39afffb297
4 changed files with 19 additions and 13 deletions

View file

@ -223,12 +223,10 @@ class GenerateSampleNotifications extends Maintenance {
$previousContent = $content->getText(); $previousContent = $content->getText();
} }
} }
$status = $page->doEditContent( $status = $page->doUserEditContent(
new WikitextContent( $contentText . $previousContent ), new WikitextContent( $contentText . $previousContent ),
'generating sample notifications', $agent,
0, 'generating sample notifications'
false,
$agent
); );
if ( !$status->isGood() ) { if ( !$status->isGood() ) {
@ -297,7 +295,15 @@ class GenerateSampleNotifications extends Maintenance {
true // undoIsLatest true // undoIsLatest
); );
$status = $page->doEditContent( $content, 'undo', 0, false, $agent, null, [], $undoRev->getId() ); $status = $page->doUserEditContent(
$content,
$agent,
'undo',
0, // $flags
false, // $originalRevId
[], // $tags
$undoRev->getId()
);
if ( !$status->isGood() ) { if ( !$status->isGood() ) {
$this->error( "Failed to undo {$moai->getPrefixedText()}: {$status->getMessage()->text()}" ); $this->error( "Failed to undo {$moai->getPrefixedText()}: {$status->getMessage()->text()}" );

View file

@ -942,9 +942,11 @@ TEXT
// pages to be created: templates may be used to ping users (e.g. // pages to be created: templates may be used to ping users (e.g.
// {{u|...}}) but if we don't have that template, it just won't work! // {{u|...}}) but if we don't have that template, it just won't work!
$pages += [ $title => '' ]; $pages += [ $title => '' ];
$user = $this->getTestUser()->getUser();
foreach ( $pages as $pageTitle => $pageText ) { foreach ( $pages as $pageTitle => $pageText ) {
$template = WikiPage::factory( Title::newFromText( $pageTitle ) ); $template = WikiPage::factory( Title::newFromText( $pageTitle ) );
$template->doEditContent( new WikitextContent( $pageText ), '' ); $template->doUserEditContent( new WikitextContent( $pageText ), $user, '' );
} }
// force i18n messages to be reloaded from MessageCache (from DB, where a new message // force i18n messages to be reloaded from MessageCache (from DB, where a new message

View file

@ -72,6 +72,6 @@ class MWEchoThankYouEditTest extends MediaWikiTestCase {
private function edit( Title $title, User $user, $text ) { private function edit( Title $title, User $user, $text ) {
$page = WikiPage::factory( $title ); $page = WikiPage::factory( $title );
$content = ContentHandler::makeContent( $text, $title ); $content = ContentHandler::makeContent( $text, $title );
$page->doEditContent( $content, 'test', 0, false, $user ); $page->doUserEditContent( $content, $user, 'test' );
} }
} }

View file

@ -108,12 +108,10 @@ class EchoUserLocatorTest extends MediaWikiTestCase {
*/ */
public function testLocateArticleCreator( $message, $initialize ) { public function testLocateArticleCreator( $message, $initialize ) {
list( $expect, $title, $user ) = $initialize(); list( $expect, $title, $user ) = $initialize();
WikiPage::factory( $title )->doEditContent( WikiPage::factory( $title )->doUserEditContent(
/* $content = */ ContentHandler::makeContent( 'content', $title ), /* $content = */ ContentHandler::makeContent( 'content', $title ),
/* $summary = */ 'summary', /* $user = */ $user,
/* $flags = */ 0, /* $summary = */ 'summary'
/* $baseRevId = */ false,
/* $user = */ $user
); );
$event = $this->mockEchoEvent(); $event = $this->mockEchoEvent();