Manual:Hooks/SecondaryDataUpdates

From MediaWiki.org
Jump to navigation Jump to search
SecondaryDataUpdates
Available from version 1.25.0
Allows modification of the list of DataUpdates to perform when page content is modified.
Define function:
public static function onSecondaryDataUpdates( Title $title, Content $oldContent, bool $recursive, ParserOutput $parserOutput, &$updates ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SecondaryDataUpdates": "MyExtensionHooks::onSecondaryDataUpdates"
	}
}

For MediaWiki ≤1.25:

$wgHooks['SecondaryDataUpdates'][] = 'MyExtensionHooks::onSecondaryDataUpdates';
Called from:File(s): content/AbstractContent.php
Function(s): AbstractContent::getSecondaryDataUpdates()

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

Details[edit]

  • $title: Title of the page that is being edited.
  • $content: Content object representing the page's content before the edit.
  • $recursive: bool indicating whether DataUpdates should trigger recursive updates (relevant mostly for LinksUpdate).
  • $parserOutput: ParserOutput representing the rendered version of the page after the edit
  • $updates: a list of DataUpdate objects, to be modified or replaced by the hook handler