Mark various skin/OutputPage hooks as unabortable
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 19 Aug 2017 00:48:45 +0000 (17:48 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 19 Sep 2017 19:43:17 +0000 (19:43 +0000)
Follows-up I94c7ab656bd1a04. An initial pass of marking various
hooks as unabortable.

* BeforePageDisplay (T173411)
* OutputPageParserOutput
* AfterFinalPageOutput
* SkinTemplateNavigation (T107980)
* SkinTemplateNavigation::SpecialPage (T107980)
* SkinTemplateNavigation::Universal
* PersonalUrls

Bug: T173615
Change-Id: I0cb333dd5ff74f7dca725ff210200a0779a9a360

includes/OutputPage.php
includes/skins/SkinTemplate.php

index 5216146..7c463b6 100644 (file)
@@ -1852,7 +1852,7 @@ class OutputPage extends ContextSource {
                // Avoid PHP 7.1 warning of passing $this by reference
                $outputPage = $this;
                Hooks::run( 'LanguageLinks', [ $this->getTitle(), &$this->mLanguageLinks, &$linkFlags ] );
-               Hooks::run( 'OutputPageParserOutput', [ &$outputPage, $parserOutput ] );
+               Hooks::runWithoutAbort( 'OutputPageParserOutput', [ &$outputPage, $parserOutput ] );
 
                // This check must be after 'OutputPageParserOutput' runs in addParserOutputMetadata
                // so that extensions may modify ParserOutput to toggle TOC.
@@ -1890,7 +1890,7 @@ class OutputPage extends ContextSource {
                $text = $parserOutput->getText();
                // Avoid PHP 7.1 warning of passing $this by reference
                $outputPage = $this;
-               Hooks::run( 'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
+               Hooks::runWithoutAbort( 'OutputPageBeforeHTML', [ &$outputPage, &$text ] );
                $this->addHTML( $text );
        }
 
@@ -2436,7 +2436,7 @@ class OutputPage extends ContextSource {
                        $outputPage = $this;
                        // Hook that allows last minute changes to the output page, e.g.
                        // adding of CSS or Javascript by extensions.
-                       Hooks::run( 'BeforePageDisplay', [ &$outputPage, &$sk ] );
+                       Hooks::runWithoutAbort( 'BeforePageDisplay', [ &$outputPage, &$sk ] );
 
                        try {
                                $sk->outputPage();
@@ -2448,7 +2448,7 @@ class OutputPage extends ContextSource {
 
                try {
                        // This hook allows last minute changes to final overall output by modifying output buffer
-                       Hooks::run( 'AfterFinalPageOutput', [ $this ] );
+                       Hooks::runWithoutAbort( 'AfterFinalPageOutput', [ $this ] );
                } catch ( Exception $e ) {
                        ob_end_clean(); // bug T129657
                        throw $e;
index 4fcc865..0690f03 100644 (file)
@@ -729,7 +729,7 @@ class SkinTemplate extends Skin {
                        }
                }
 
-               Hooks::run( 'PersonalUrls', [ &$personal_urls, &$title, $this ] );
+               Hooks::runWithoutAbort( 'PersonalUrls', [ &$personal_urls, &$title, $this ] );
                return $personal_urls;
        }
 
@@ -1095,7 +1095,10 @@ class SkinTemplate extends Skin {
 
                        // Avoid PHP 7.1 warning of passing $this by reference
                        $skinTemplate = $this;
-                       Hooks::run( 'SkinTemplateNavigation', [ &$skinTemplate, &$content_navigation ] );
+                       Hooks::runWithoutAbort(
+                               'SkinTemplateNavigation',
+                               [ &$skinTemplate, &$content_navigation ]
+                       );
 
                        if ( $userCanRead && !$wgDisableLangConversion ) {
                                $pageLang = $title->getPageLanguage();
@@ -1139,14 +1142,15 @@ class SkinTemplate extends Skin {
 
                        // Avoid PHP 7.1 warning of passing $this by reference
                        $skinTemplate = $this;
-                       Hooks::run( 'SkinTemplateNavigation::SpecialPage',
+                       Hooks::runWithoutAbort( 'SkinTemplateNavigation::SpecialPage',
                                [ &$skinTemplate, &$content_navigation ] );
                }
 
                // Avoid PHP 7.1 warning of passing $this by reference
                $skinTemplate = $this;
                // Equiv to SkinTemplateContentActions
-               Hooks::run( 'SkinTemplateNavigation::Universal', [ &$skinTemplate, &$content_navigation ] );
+               Hooks::runWithoutAbort( 'SkinTemplateNavigation::Universal',
+                       [ &$skinTemplate, &$content_navigation ] );
 
                // Setup xml ids and tooltip info
                foreach ( $content_navigation as $section => &$links ) {