Manual:Hooks/WikiPageDeletionUpdates

From MediaWiki.org
Jump to navigation Jump to search
WikiPageDeletionUpdates
Available from version 1.21.0
manipulate the list of DeferrableUpdates to be applied when a page is deleted. Called in WikiPage::getDeletionUpdates(). Note that updates specific to a content model should be provided by the respective Content's getDeletionUpdates() method.
Define function:
public static function onWikiPageDeletionUpdates( WikiPage $page, Content $content = null, array &$updates ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"WikiPageDeletionUpdates": "MyExtensionHooks::onWikiPageDeletionUpdates"
	}
}

For MediaWiki ≤1.25:

$wgHooks['WikiPageDeletionUpdates'][] = 'MyExtensionHooks::onWikiPageDeletionUpdates';
Called from:File(s): page/WikiPage.php

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

Details[edit]

  • $page: the WikiPage
  • $content: the Content to generate updates for, or null in case the page revision could not be loaded. The delete will succeed despite this.
  • &$updates: the array of objects that implement DeferrableUpdate. Hook function may want to add to it.