Manual:Hooks/ArticleUndelete

From Linux Web Expert

ArticleUndelete
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
When one or more revisions of an article are restored
<translate> Define function:</translate>
public static function onArticleUndelete( MediaWiki\Title\Title $title, bool $create, string $comment, int $oldPageId, array $restoredPages ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ArticleUndelete": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleUndelete"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> page/PageArchive.php
<translate> Interface:</translate> ArticleUndeleteHook.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:ArticleUndelete extensions</tvar>.</translate>

Details

  • $title: Title corresponding to the article restored
  • $create: Whether or not the restoration caused the page to be created (i.e. it didn't exist before)
  • $comment: Comment explaining the undeletion
  • $oldPageId: ID of page previously deleted (from archive table). This ID will be used for the restored page. (since gerrit:133631)
  • $restoredPages: Set of page IDs that have revisions restored for the undelete, with keys being page IDs and values are 'true'. (since gerrit: 281078)