Manual:Hooks/PageViewUpdates

From Linux Web Expert

PageViewUpdates
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Called after a page view is seen by MediaWiki. Note this does not capture views made via external caches such as Squid.
<translate> Define function:</translate>
public static function onPageViewUpdates( WikiPage $wikipage, User $user ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"PageViewUpdates": "MediaWiki\\Extension\\MyExtension\\Hooks::onPageViewUpdates"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> page/WikiPage.php
<translate> Interface:</translate> PageViewUpdatesHook.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:PageViewUpdates extensions</tvar>.</translate>

Details

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