From: Jens Frank Date: Tue, 13 Jul 2004 06:42:55 +0000 (+0000) Subject: move $this->initialiseVariables down to where the variables are used the first time... X-Git-Tag: 1.5.0alpha1~2686 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=6606778166297314ca4e4c4dba0d49ceefd88f8e;p=lhc%2Fweb%2Fwiklou.git move $this->initialiseVariables down to where the variables are used the first time. This removes one SQL query per page view if no variables are used on that page. --- diff --git a/includes/Parser.php b/includes/Parser.php index 5412334e58..4e0913b640 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1450,9 +1450,6 @@ class Parser wfProfileIn( $fname ); $bail = false; - if ( !$this->mVariables ) { - $this->initialiseVariables(); - } $titleChars = Title::legalChars(); $nonBraceChars = str_replace( array( '{', '}' ), array( '', '' ), $titleChars ); @@ -1481,6 +1478,9 @@ class Parser } function variableSubstitution( $matches ) { + if ( !$this->mVariables ) { + $this->initialiseVariables(); + } if ( array_key_exists( $matches[1], $this->mVariables ) ) { $text = $this->mVariables[$matches[1]]; $this->mOutput->mContainsOldMagic = true; @@ -1605,6 +1605,9 @@ class Parser } # Internal variables + if ( !$this->mVariables ) { + $this->initialiseVariables(); + } if ( !$found && array_key_exists( $part1, $this->mVariables ) ) { $text = $this->mVariables[$part1]; $found = true;