Manual:Hooks/ArticleProtect

From Linux Web Expert

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

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ArticleProtect extensions</tvar>.</translate>

Details

  • $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