MediaWiki  master
MediaWiki\Storage\Hook\BeforeRevertedTagUpdateHook Interface Reference

This is a hook handler interface, see docs/Hooks.md. More...

Inheritance diagram for MediaWiki\Storage\Hook\BeforeRevertedTagUpdateHook:

Public Member Functions

 onBeforeRevertedTagUpdate ( $wikiPage, $user, $summary, $flags, $revisionRecord, $editResult, &$approved)
 This hook is called before scheduling a RevertedTagUpdateJob. More...
 

Detailed Description

This is a hook handler interface, see docs/Hooks.md.

Use the hook name "BeforeRevertedTagUpdate" to register handlers implementing this interface.

Stable to implement

Definition at line 18 of file BeforeRevertedTagUpdateHook.php.

Member Function Documentation

◆ onBeforeRevertedTagUpdate()

MediaWiki\Storage\Hook\BeforeRevertedTagUpdateHook::onBeforeRevertedTagUpdate (   $wikiPage,
  $user,
  $summary,
  $flags,
  $revisionRecord,
  $editResult,
$approved 
)

This hook is called before scheduling a RevertedTagUpdateJob.

Various content management extensions that involve some kind of approval mechanism for edits can use this to indicate that the RevertedTagUpdate should not be performed right after the edit is made, but rather it should wait for the edit to be approved. To delay the execution of the update simply implement this hook and set the $approved parameter to false when the user does not have an "autoreview" user right or similar.

The update can be later rescheduled using RevertedTagUpdateManager. In your code that marks an edit as "approved" use:

$revertedTagUpdateManager =
MediaWikiServices::getInstance()->getRevertedTagUpdateManager();
$revertedTagUpdateManager->approveRevertedTagForRevision( $acceptedRevisionId );

And that's it.

There should be no adverse effects due to enqueueing the same update multiple times.

Since
1.36
Parameters
WikiPage$wikiPageWikiPage modified
UserIdentity$userUser performing the modification
CommentStoreComment$summaryEdit summary/comment
int$flagsFlags passed to WikiPage::doEditContent()
RevisionRecord$revisionRecordNew RevisionRecord of the article
EditResult$editResultObject storing information about the effects of this edit, including which edits were reverted and which edit is this based on (for reverts and null edits).
bool&$approvedWhether the edit is considered approved. Setting it to false will abort the update, true will cause the update to be executed normally. If patrolling is enabled, the passed value will indicate whether the edit is autopatrolled or not. In case patrolling is disabled on the wiki, the passed value will always be true, unless modified by other extensions.
Returns
void This hook must not abort, it must return no value

Implemented in MediaWiki\HookContainer\HookRunner.


The documentation for this interface was generated from the following file:
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
Definition: MediaWikiServices.php:197