Manual:Hooks/ArticleSave/1.5

ArticleSave
Available from version 1.4.0
Occurs whenever the software receives a request to save an article
Define function:
public static function onArticleSave( &$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ArticleSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleSave"
	}
}
Called from: File(s): Article.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 (object) being saved
  • $user: the user (object) saving the article
  • $text: the new article text
  • $summary: the article summary (comment)
  • $isminor: minor flag
  • $iswatch: watch flag
  • $section: section #

Notes edit

This did not apply to newly uploaded images until v1.4.5.

In previous versions, this hook was included in EditPage.php: EditPage.attemptSave() and Image.php: RecordUpload()

See also edit