Available from version 1.4.0
Occurs whenever the software receives a request to protect an article
Define function:
public static function onArticleProtect( &$wikiPage, &$user, $protect, $reason, $moveonly ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"ArticleProtect": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleProtect"
Called from: File(s): page/WikiPage.php
Interface: ArticleProtectHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ArticleProtect extensions.

Details edit

  • $wikiPage: (object) the wikipage being protected
  • $user: (object) the user doing the protection
  • $protect*: boolean flag indicating whether the request is protect or unprotect
  • $reason: (string) Reason for protect
  • $moveonly: (boolean) flag indicating whether this is for move only or not

See also edit