From: Brion Vibber Date: Tue, 18 Jan 2005 10:16:55 +0000 (+0000) Subject: * Skip message cache initialization on raw page view (quick hack) X-Git-Tag: 1.5.0alpha1~897 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=0defdc6a3efca1c24d2bf9d497f515e82a21ab6e;p=lhc%2Fweb%2Fwiklou.git * Skip message cache initialization on raw page view (quick hack) The MediaWiki:Sitenotice hack as currently written forces message cache initiali zation early in Setup.php. This adds up to 30% to the runtime on raw page views and cache hits where no skin output has to be made, and dynamic CSS means we've got a fair amount of raw page views. --- diff --git a/includes/Setup.php b/includes/Setup.php index 0b4f01a11d..dbd07a4b5a 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -366,21 +366,25 @@ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' ); $wgArticle = new Article($wgTitle); # Site notice - -$notice = wfMsg( 'sitenotice' ); -if($notice == '<sitenotice>') $notice = ''; -# Allow individual wikis to turn it off -if ( $notice == '-' ) { - $wgSiteNotice = ''; -} else { - # if($wgSiteNotice) $notice .= $wgSiteNotice; - if ($notice == '') { - $notice = $wgSiteNotice; - } - if($notice != '-' && $notice != '') { - $specialparser = new Parser(); - $parserOutput = $specialparser->parse( $notice, $wgTitle, $wgOut->mParserOptions, false ); - $wgSiteNotice = $parserOutput->getText(); +# FIXME: This is an ugly hack, which wastes runtime on cache hits +# and raw page views by forcing initialization of the message cache. +# Try to fake around it for raw at least: +if( !isset( $_REQUEST['action'] ) || $_REQUEST['action'] != 'raw' ) { + $notice = wfMsg( 'sitenotice' ); + if($notice == '<sitenotice>') $notice = ''; + # Allow individual wikis to turn it off + if ( $notice == '-' ) { + $wgSiteNotice = ''; + } else { + # if($wgSiteNotice) $notice .= $wgSiteNotice; + if ($notice == '') { + $notice = $wgSiteNotice; + } + if($notice != '-' && $notice != '') { + $specialparser = new Parser(); + $parserOutput = $specialparser->parse( $notice, $wgTitle, $wgOut->mParserOptions, false ); + $wgSiteNotice = $parserOutput->getText(); + } } }