From 31baa8a17a46fa5b852a3cd5a8f7fb4e0e29e43c Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 17 Jan 2008 08:58:24 +0000 Subject: [PATCH] Added ParserFirstCallInit hook. Deferred function registration in ParserFunctions until this hook is called. --- includes/Defines.php | 3 ++- includes/Parser.php | 4 +++- includes/Parser_OldPP.php | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/Defines.php b/includes/Defines.php index 1a62d45c54..1be90f9702 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -262,6 +262,7 @@ define( 'UTF8_TAIL', true ); # Hook support constants define( 'MW_SUPPORTS_EDITFILTERMERGED', 1 ); +define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 ); # Allowed values for Parser::$mOutputType # Parameter to Parser::startExternalParse(). @@ -282,4 +283,4 @@ define( 'RLH_FOR_UPDATE', 1 ); define( 'APCOND_EDITCOUNT', 1 ); define( 'APCOND_AGE', 2 ); define( 'APCOND_EMAILCONFIRMED', 3 ); -define( 'APCOND_INGROUPS', 4 ); \ No newline at end of file +define( 'APCOND_INGROUPS', 4 ); diff --git a/includes/Parser.php b/includes/Parser.php index 6132cc871e..24016d8c7f 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -126,6 +126,7 @@ class Parser if ( !$this->mFirstCall ) { return; } + $this->mFirstCall = false; wfProfileIn( __METHOD__ ); global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions; @@ -174,7 +175,8 @@ class Parser } $this->initialiseVariables(); - $this->mFirstCall = false; + + wfRunHooks( 'ParserFirstCallInit', array( &$this ) ); wfProfileOut( __METHOD__ ); } diff --git a/includes/Parser_OldPP.php b/includes/Parser_OldPP.php index c48ed3be6a..24711e99d4 100644 --- a/includes/Parser_OldPP.php +++ b/includes/Parser_OldPP.php @@ -81,6 +81,7 @@ class Parser_OldPP if ( !$this->mFirstCall ) { return; } + $this->mFirstCall = false; wfProfileIn( __METHOD__ ); global $wgAllowDisplayTitle, $wgAllowSlowParserFunctions; @@ -128,7 +129,8 @@ class Parser_OldPP } $this->initialiseVariables(); - $this->mFirstCall = false; + + wfRunHooks( 'ParserFirstCallInit', array( &$this ) ); wfProfileOut( __METHOD__ ); } -- 2.20.1