Manual:Hooks/ArticleSave

From MediaWiki.org
Jump to: navigation, search
ArticleSave
Available from version 1.4.0
Occurs whenever the software receives a request to save an article. Can be used to cancel or modify that request.

*Define function:
function fnMyHook( &$article, &$user, &$text, &$summary,
$minor, $watchthis, $sectionanchor, &$flags, &$status
) { ... }

*Attach hook:
$wgHooks['ArticleSave'][] = 'MyExtensionHooks::someExample';
Called from: WikiPage.php

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


[edit] Details

  • $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

[edit] Notes

  • $flags was introduced in 1.7
  • $minor was passed by reference before 1.7
  • $watch and $sectionanchor were in use before 1.7 and were passed by reference
  • This hook was called from EditPage and Image before 1.6.
  • This hook was called from Article.php prior to 1.18 (approximately).

[edit] See also

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox