* 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.
This commit is contained in:
parent
0a4c6b04f1
commit
0defdc6a3e
1 changed files with 19 additions and 15 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue