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();
}
}
$status = $page->doEditContent(
$status = $page->doUserEditContent(
new WikitextContent( $contentText . $previousContent ),
'generating sample notifications',
0,
false,
$agent
$agent,
'generating sample notifications'
);
if ( !$status->isGood() ) {
@ -297,7 +295,15 @@ class GenerateSampleNotifications extends Maintenance {
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() ) {
$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.
// {{u|...}}) but if we don't have that template, it just won't work!
$pages += [ $title => '' ];
$user = $this->getTestUser()->getUser();
foreach ( $pages as $pageTitle => $pageText ) {
$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

View file

@ -72,6 +72,6 @@ class MWEchoThankYouEditTest extends MediaWikiTestCase {
private function edit( Title $title, User $user, $text ) {
$page = WikiPage::factory( $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 ) {
list( $expect, $title, $user ) = $initialize();
WikiPage::factory( $title )->doEditContent(
WikiPage::factory( $title )->doUserEditContent(
/* $content = */ ContentHandler::makeContent( 'content', $title ),
/* $summary = */ 'summary',
/* $flags = */ 0,
/* $baseRevId = */ false,
/* $user = */ $user
/* $user = */ $user,
/* $summary = */ 'summary'
);
$event = $this->mockEchoEvent();