jenkins-bot has submitted this change and it was merged.

Change subject: Keep onBeforePageDisplay from firing multiple times
......................................................................


Keep onBeforePageDisplay from firing multiple times

Use a local static flag to track usage state in
BuggyHooks::onBeforePageDisplay and return without generating an error
if the hook has already executed in the same request cycle. This keeps
the hook from causing a second error during a second page render attempt
as happens for some error display processing.

Change-Id: Id5edfd7e1b6c629a8e9bdc6265cca126ed324159
---
M Buggy.hooks.php
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Buggy.hooks.php b/Buggy.hooks.php
index 30c4de2..9bc35d7 100644
--- a/Buggy.hooks.php
+++ b/Buggy.hooks.php
@@ -7,7 +7,14 @@
  */
 
 class BuggyHooks {
-       public static function onBeforePageDisplay( OutputPage  &$out, Skin 
&$skin ) {
+       public static function onBeforePageDisplay( OutputPage &$out, Skin 
&$skin ) {
+               static $fired = false;
+               if ( $fired ) {
+                       // Only fire once per request
+                       return true;
+               }
+               $fired = true;
+
                $queryValues = $out->getRequest()->getQueryValues();
                if ( isset( $queryValues['buggy'] ) ) {
                        $buggy = $queryValues['buggy'];

-- 
To view, visit https://gerrit.wikimedia.org/r/233415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5edfd7e1b6c629a8e9bdc6265cca126ed324159
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Buggy
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to