Manual:Hooks/BeforeRevertedTagUpdate
Appearance
BeforeRevertedTagUpdate | |
---|---|
Available from version 1.36.0 (Gerrit change 609773) This hook is called before scheduling a RevertedTagUpdateJob. | |
Define function: | public static function onBeforeRevertedTagUpdate( $wikiPage, $user, $summary,$flags, $revisionRecord, $editResult, &$approved ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"BeforeRevertedTagUpdate": "MediaWiki\\Extension\\MyExtension\\Hooks::onBeforeRevertedTagUpdate"
}
}
|
Called from: | File(s): Storage/PageUpdater.php Function(s): getAtomicSectionUpdate |
Interface: | BeforeRevertedTagUpdateHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:BeforeRevertedTagUpdate extensions.
Various content management extensions that involve some kind of approval mechanism for edits can use this to indicate that the MediaWiki\Storage\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 MediaWiki\Storage\RevertedTagUpdateManager
. In your code that marks an edit as "approved" use:
$revertedTagUpdateManager = MediaWikiServices::getInstance()->getRevertedTagUpdateManager();
$revertedTagUpdateManager->approveRevertedTagForRevision( $acceptedRevisionId );
Parameters
[edit]$wikiPage
:WikiPage
modified$user
: The user performing the modification, instance ofMediaWiki\User\UserIdentity
$summary
: Edit summary/comment, instance ofCommentStoreComment
$flags
: Anint
, Flags passed toWikiPage::doEditContent()
$revisionRecord
: NewMediaWiki\Revision\RevisionRecord
of the article$editResult
: AMediaWiki\Storage\EditResult
object 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).&$approved
: Abool
, representing whether the edit is considered approved. Setting it tofalse
will abort the update, while setting it totrue
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 betrue
, unless modified by other extensions.