From c7d9e79f9e9300dfbf078d34010c5bd0ddd08a81 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 18 Aug 2017 17:48:45 -0700 Subject: [PATCH] Mark various skin/OutputPage hooks as unabortable 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 | 8 ++++---- includes/skins/SkinTemplate.php | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 52161466a6..7c463b6f02 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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; diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 4fcc8657b0..0690f035c0 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -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 ) { -- 2.20.1