From 7969562308fb33e7e77cc23bec3b2951187ed0ca Mon Sep 17 00:00:00 2001 From: Daniel Werner Date: Wed, 4 Jul 2012 23:23:56 +0200 Subject: [PATCH] We need this 'AfterFinalPageOutput' hook for the STTLanguage extension. Change-Id: I1f131e87324cb7a62355dc296f0b4d411a9a0800 --- RELEASE-NOTES-1.20 | 2 ++ docs/hooks.txt | 5 +++++ includes/OutputPage.php | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 3c545eea9e..46d85046c8 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -74,6 +74,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * Added new function getDomain to AuthPlugin for getting a user's domain * (bug 23427) New magic word {{PAGEID}} which gives the current page ID. Will be null on previewing a page being created. +* Added new hook AfterFinalPageOutput to allow modifications to buffered page output before sent + to the client. === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/docs/hooks.txt b/docs/hooks.txt index d32612d814..dd6763141b 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -279,6 +279,11 @@ $article: Article object $user: the User object that was created. (Parameter added in 1.7) $byEmail: true when account was created "by email" (added in 1.12) +'AfterFinalPageOutput': At the end of OutputPage::output() but before +final ob_end_flush() which will send the buffered output to the client. +This allows for last-minute modification of the output within the buffer +by using ob_get_clean(). + 'AfterImportPage': When a page import is completed $title: Title under which the revisions were imported $origTitle: Title provided by the XML file diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7f0a4e2d21..e96c61f982 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1989,7 +1989,11 @@ class OutputPage extends ContextSource { } $this->sendCacheControl(); + + wfRunHooks( 'AfterFinalPageOutput', array( &$this ) ); + ob_end_flush(); + wfProfileOut( __METHOD__ ); } -- 2.20.1