Manual:Hooks/ArticleSave/1.5

From Linux Web Expert

Revision as of 09:55, 6 October 2020 by imported>Baris6161TURK
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ArticleSave
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Occurs whenever the software receives a request to save an article
<translate> Define function:</translate>
public static function onArticleSave( &$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ArticleSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleSave"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> Article.php
<translate> Interface:</translate> ArticleSaveHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ArticleSave extensions</tvar>.</translate>

Details

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

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