Manual:Hooks/PageViewUpdates

From MediaWiki.org
Jump to navigation Jump to search
PageViewUpdates
Available from version 1.25.0
Called after a page view is seen by MediaWiki. Note this does not capture views made via external caches such as Squid.
Define function:
public static function onPageViewUpdates( WikiPage $wikipage, User $user ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PageViewUpdates": "MyExtensionHooks::onPageViewUpdates"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PageViewUpdates'][] = 'MyExtensionHooks::onPageViewUpdates';
Called from:File(s): page/WikiPage.php

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

Details[edit]

  • $wikipage: WikiPage for the page being viewed.
  • $user: User for the user who is viewing.