* Skip message cache initialization on raw page view (quick hack)
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 18 Jan 2005 10:16:55 +0000 (10:16 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 18 Jan 2005 10:16:55 +0000 (10:16 +0000)
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.

includes/Setup.php

index 0b4f01a..dbd07a4 100644 (file)
@@ -366,21 +366,25 @@ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' );
 $wgArticle = new Article($wgTitle);
 
 # Site notice
-
-$notice = wfMsg( 'sitenotice' );
-if($notice == '&lt;sitenotice&gt;') $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 == '&lt;sitenotice&gt;') $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();
+               }
        }
 }