Fix some profiling errors in wfGetSiteNotice() if no sitenotice is defined
authorAlex Z <mrzman@users.mediawiki.org>
Thu, 9 Oct 2008 21:08:42 +0000 (21:08 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Thu, 9 Oct 2008 21:08:42 +0000 (21:08 +0000)
includes/GlobalFunctions.php

index 4c527c8..1bbf4b9 100644 (file)
@@ -1879,14 +1879,18 @@ function wfGetSiteNotice() {
        if( $wgUser instanceOf User && $wgUser->isLoggedIn() ) {
                $loggedIn = true;
                $siteNotice = wfGetCachedNotice('sitenotice');
-               if($siteNotice === false)
+               if($siteNotice === false) {
+                       wfProfileOut( $fname );
                        return '';
+               }
        } else {
                $siteNotice = wfGetCachedNotice('anonnotice');
                if($siteNotice === false) {
                        $siteNotice = wfGetCachedNotice('sitenotice');
-                       if($siteNotice === false)
+                       if($siteNotice === false) {
+                               wfProfileOut( $fname );
                                return '';
+                       }
                }
        }
        
@@ -1896,8 +1900,10 @@ function wfGetSiteNotice() {
        if( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice ) ) ) {
                if( $loggedIn ) {
                        //it is hidden
-                       if( isset($_COOKIE[$wgCookiePrefix . 'DismissSiteNotice']) && $_COOKIE[$wgCookiePrefix . 'DismissSiteNotice'] == $id )
+                       if( isset($_COOKIE[$wgCookiePrefix . 'DismissSiteNotice']) && $_COOKIE[$wgCookiePrefix . 'DismissSiteNotice'] == $id ) {
+                               wfProfileOut( $fname );
                                return '';
+                       }
                        $siteNotice = <<<EOT
 <table width="100%" id="mw-dismissable-notice"><tr><td width="80%">$siteNotice</td>
 <td width="20%" align="right">[<a id="dismissLink" href="$spUrl">$msgClose</a>]</td></tr></table>