Open main menu

Manual:Hooks/PageContentSaveComplete

< Manual:Hooks
PageContentSaveComplete
Available from version 1.21.0
Occurs after the save page request has been processed
Define function:
public static function onPageContentSaveComplete( $wikiPage, $user, $mainContent, $summaryText, $isMinor, $isWatch, $section, &$flags, $revision, $status, $origionalRevId, $undidRevId ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PageContentSaveComplete": "MyExtensionHooks::onPageContentSaveComplete"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PageContentSaveComplete'][] = 'MyExtensionHooks::onPageContentSaveComplete';
Called from:File(s): Storage/PageUpdater.php

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

DetailsEdit

  • $wikiPage: WikiPage modified
  • $user: User performing the modification
  • $mainContent: New content, as a Content object
  • $summary: Edit summary/comment
  • $isMinor: Whether or not the edit was marked as minor
  • $isWatch: (No longer used)
  • $section: (No longer used)
  • $flags: Flags passed to WikiPage::doEditContent()
  • $revision: Revision object of the saved content. If the save did not result in the creation of a new revision (e.g. the submission was equal to the latest revision), this parameter may be null (null edits, or "no-op"). However, there are reports (see phab:T128838) that it's instead set to that latest revision.
  • $status: Status object about to be returned by doEditContent()
  • $origionalRevId: the rev ID (or false) this edit was based on
  • $undidRevId: the rev ID (or 0) this edit undid 1.30+

The function should return true to continue hook processing or false to abort. This hook will be triggered both by edits made through the edit page, and by edits made through the API.

Example handlerEdit

/**
 * Occurs after the save page request has been processed.
 *
 * @param WikiPage $wikiPage
 * @param User $user
 * @param Content $content
 * @param string $summary
 * @param bool $isMinor
 * @param bool $isWatch
 * @param null $section Deprecated
 * @param int $flags
 * @param Revision|null $revision
 * @param Status $status
 * @param int|bool $baseRevId
 * @param int $undidRevId
 *
 * @return boolean
 * @see https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete
 */
public static function onPageContentSaveComplete(
    $wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags,
    $revision, $status, $baseRevId, $undidRevId
) {
# ...
}

See alsoEdit