Manual:Hooks/ArticleDelete

From Linux Web Expert

ArticleDelete
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Occurs whenever the software receives a request to delete an article
<translate> Define function:</translate>
public static function onArticleDelete( WikiPage &$article, User &$user, &$reason, &$error ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ArticleDelete": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleDelete"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> page/DeletePage.php
<translate> Interface:</translate> ArticleDeleteHook.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:ArticleDelete extensions</tvar>.</translate>

Details

  • $article: the article that was deleted (WikiPage object) 1.18+
  • $user: the user (object) deleting the article
  • $reason: the reason (string) the article is being deleted
  • $error: if the requested article deletion was prohibited, the (raw HTML) error message to display 1.13+

See also