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:
public static function onArticleSave( &$article, &$user, &$text, &$summary,<br />$minor, $watchthis, $sectionanchor, &$flags, &$status ) { ... }
Attach hook:
$wgHooks['ArticleSave'][] = 'MyExtensionHooks::onArticleSave';
Called from: File(s): WikiPage.php

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


Details[edit | edit source]

  • $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
  • $status: Status object, see documentation for details (since 1.14.0)

Notes[edit | edit source]

  • This hook was called from Article.php prior to 1.18 (approximately).
  • $status was introduced in 1.14
  • $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

See also[edit | edit source]