Create PageViewUpdates hook
authorMark A. Hershberger <mah@nichework.com>
Thu, 30 Apr 2015 02:23:30 +0000 (22:23 -0400)
committerMark A. Hershberger <mah@nichework.com>
Thu, 30 Apr 2015 13:17:33 +0000 (09:17 -0400)
Bug: T97622
Change-Id: I0f2dedf84a540b6f87623792c7b4f8b8ad8f8059

docs/hooks.txt
includes/page/WikiPage.php

index 6f59b2d..6e00363 100644 (file)
@@ -2125,6 +2125,12 @@ the key.
 &$confstr: reference to a hash key string which can be modified
 $user: User (object) requesting the page
 
+'PageViewUpdate': Allow database (or other) changes to be made after a
+page view is seen by MediaWiki.  Note this does not capture views made
+via external caches such as Squid.
+$wikipage: WikiPage (object) for the page being viewed.
+$user: User (object) for the user who is viewing.
+
 'ParserAfterParse': Called from Parser::parse() just after the call to
 Parser::internalParse() returns.
 $parser: parser object
index 752565d..e938ca8 100644 (file)
@@ -1141,6 +1141,7 @@ class WikiPage implements Page, IDBAccessObject {
                        return;
                }
 
+               Hooks::run( 'PageViewUpdates', array( $this, $user ) );
                // Update newtalk / watchlist notification status
                try {
                        $user->clearNotification( $this->mTitle, $oldid );