From: Tim Starling Date: Mon, 3 Jul 2006 11:08:02 +0000 (+0000) Subject: Use $wgParser instead of constructing a new parser object. Constructing a new one... X-Git-Tag: 1.31.0-rc.0~56442 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=8e452c22a7ecaa0dbd47fbabb2606d761c2c978b;p=lhc%2Fweb%2Fwiklou.git Use $wgParser instead of constructing a new parser object. Constructing a new one is now more expensive than ever. --- diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 1247f3fb6e..666673423e 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -26,8 +26,7 @@ class MessageCache { var $mDeferred = true; function __construct( &$memCached, $useDB, $expiry, $memcPrefix) { - $fname = 'MessageCache::initialise'; - wfProfileIn( $fname ); + wfProfileIn( __METHOD__ ); $this->mUseCache = !is_null( $memCached ); $this->mMemc = &$memCached; @@ -38,12 +37,9 @@ class MessageCache { $this->mKeys = false; # initialised on demand $this->mInitialised = true; - wfProfileIn( $fname.'-parseropt' ); + wfProfileIn( __METHOD__.'-parseropt' ); $this->mParserOptions = new ParserOptions( $u=NULL ); - wfProfileOut( $fname.'-parseropt' ); - wfProfileIn( $fname.'-parser' ); - $this->mParser = new Parser; - wfProfileOut( $fname.'-parser' ); + wfProfileOut( __METHOD__.'-parseropt' ); # When we first get asked for a message, # then we'll fill up the cache. If we @@ -51,7 +47,7 @@ class MessageCache { # some extra milliseconds $this->mDeferred = true; - wfProfileOut( $fname ); + wfProfileOut( __METHOD__ ); } /** @@ -525,9 +521,10 @@ class MessageCache { } function transform( $message ) { - if( !$this->mDisableTransform ) { + global $wgParser; + if( !$this->mDisableTransform && isset( $wgParser ) ) { if( strpos( $message, '{{' ) !== false ) { - $message = $this->mParser->transformMsg( $message, $this->mParserOptions ); + $message = $wgParser->transformMsg( $message, $this->mParserOptions ); } } return $message;