From 05b3050d1eb5bc23f9b85b674cb5ac33dfe6d2f3 Mon Sep 17 00:00:00 2001 From: Leon Weber Date: Thu, 11 Jan 2007 14:50:34 +0000 Subject: [PATCH] * (bug 8567) Added hook RawPageViewBeforeOutput just before the text is blown out in action=raw, so extensions might influence the output. --- RELEASE-NOTES | 2 ++ docs/hooks.txt | 4 ++++ includes/RawPage.php | 8 +++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5d0e00d7ab..54e9069943 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -47,6 +47,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN now be customized via the $wgNamespaceProtection array. By default, editing pages in the MediaWiki namespace requires "editinterface" permissions, just as before. +* (bug 8567) Added hook RawPageViewBeforeOutput just before the text is blown out in action=raw, + so extensions might influence the output. == Languages updated == diff --git a/docs/hooks.txt b/docs/hooks.txt index fdae500097..c2356a6a16 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -427,6 +427,10 @@ the built-in rate limiting checks are used, if enabled. $form : PreferencesForm object &$html : HTML to append to +'RawPageViewBeforeOutput': Right before the text is blown out in action=raw +&$obj: RawPage object +&$text: The text that's going to be the output + 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed &$siteNotice: HTML returned as the sitenotice Return true to allow the normal method of notice selection/rendering to work, diff --git a/includes/RawPage.php b/includes/RawPage.php index a0b76886cd..b2c8c942ca 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -137,7 +137,13 @@ class RawPage { # allow the client to cache this for 24 hours $mode = $this->mPrivateCache ? 'private' : 'public'; header( 'Cache-Control: '.$mode.', s-maxage='.$this->mSmaxage.', max-age='.$this->mMaxage ); - echo $this->getRawText(); + $text = $this->getRawText(); + + if( !wfRunHooks( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) { + wfDebug( __METHOD__ . ': RawPageViewBeforeOutput hook broke raw page output.' ); + } + + echo $text; $wgOut->disable(); } -- 2.20.1