mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-27 17:20:40 +00:00
Fix generation of sample 'reverted' notifications
Follow-up to Id539a7db8d8f5e902177845bd212b4d6c2500f89 Pass the revision id instead of populating the request object. Change-Id: I4567d8b08999558d86c48aea5912de0e52bcf241
This commit is contained in:
parent
06386f0949
commit
577d6b39b8
|
@ -226,7 +226,6 @@ class GenerateSampleNotifications extends Maintenance {
|
|||
}
|
||||
|
||||
private function generateReverted( User $user, User $agent ) {
|
||||
global $wgRequest;
|
||||
$agent->addGroup( 'sysop' );
|
||||
|
||||
// revert (undo)
|
||||
|
@ -235,10 +234,8 @@ class GenerateSampleNotifications extends Maintenance {
|
|||
$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" );
|
||||
// hack: EchoHooks::onPageContentSaveComplete depends on the request to know which revision is being reverted
|
||||
$wgRequest->setVal( 'wpUndidRevision', $page->getRevision()->getId() );
|
||||
$content = $page->getUndoContent( $page->getRevision(), $page->getRevision()->getPrevious() );
|
||||
$status = $page->doEditContent( $content, 'undo', 0, false, $agent );
|
||||
$status = $page->doEditContent( $content, 'undo', 0, false, $agent, null, [], $page->getRevision()->getId() );
|
||||
if ( !$status->isGood() ) {
|
||||
$this->error( "Failed to undo {$moai->getPrefixedText()}: {$status->getMessage()}" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue