Jump to content

Manual:Hooks/ArticleSave

From mediawiki.org
ArticleSave
Available from version 1.4.0
Removed in version 1.29.0
Occurs whenever the software receives a request to save an article. Can be used to cancel or modify that request.
Define function:
public static function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watchthis, $sectionanchor, &$flags, &$status ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ArticleSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleSave"
	}
}
Called from: File(s): WikiPage.php
Interface: ArticleSaveHook.php

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

Details

[edit]
  • $article: the article (Article object) being saved
  • $user: the user (User object) saving the article
  • $text: the new article text
  • $summary: the edit summary
  • $minor: minor edit flag
  • $watchthis: watch the page if true, unwatch the page if false, do nothing if null (since 1.17.0)
  • $sectionanchor: not used
  • $flags: bitfield, see documentation for details 1.7+
  • $status: Status object, see documentation for details 1.14+

See also

[edit]