}
function wfGetSiteNotice() {
- global $wgSiteNotice, $wgTitle, $wgOut;
+ global $wgSiteNotice, $wgTitle, $wgOut, $parserMemc, $wgDBname;
$fname = 'wfGetSiteNotice';
wfProfileIn( $fname );
+ $shouldParse=false;
+
$notice = wfMsgForContent( 'sitenotice' );
if( $notice == '<sitenotice>' || $notice == '-' ) {
$notice = '';
$notice = $wgSiteNotice;
}
if($notice != '-' && $notice != '') {
- if( is_object( $wgOut ) ) {
- $notice = $wgOut->parse( $notice );
+ $cachednotice=$parserMemc->get("{$wgDBname}:sitenotice");
+ if (is_array($cachednotice)) {
+ if (md5($notice)==$cachednotice['hash']) {
+ $notice = $cachednotice['html'];
+ } else {
+ $shouldParse=true;
+ }
} else {
- wfDebug( "wfGetSiteNotice called with no \$wgOut available" );
- $notice = '';
+ $shouldParse=true;
+ }
+ if ($shouldParse) {
+ if( is_object( $wgOut ) ) {
+ $parsed = $wgOut->parse( $notice );
+ $parserMemc->set("{$wgDBname}:sitenotice",
+ array('html' => $parsed, 'hash' => md5($notice)), 600);
+ $notice = $parsed;
+ } else {
+ wfDebug( "wfGetSiteNotice called with no \$wgOut available" );
+ $notice = '';
+ }
}
}
wfProfileOut( $fname );