http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73192

Revision: 73192
Author:   kaldari
Date:     2010-09-17 01:03:24 +0000 (Fri, 17 Sep 2010)

Log Message:
-----------
fix for var substitution and failed cache lookup

Modified Paths:
--------------
    trunk/extensions/CentralNotice/SpecialBannerLoader.php

Modified: trunk/extensions/CentralNotice/SpecialBannerLoader.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerLoader.php      2010-09-17 
00:25:26 UTC (rev 73191)
+++ trunk/extensions/CentralNotice/SpecialBannerLoader.php      2010-09-17 
01:03:24 UTC (rev 73192)
@@ -37,7 +37,9 @@
                if ( $wgRequest->getText( 'banner' ) ) {
                        $bannerName = $wgRequest->getText( 'banner' );
                        $content = $this->getHtmlNotice( $bannerName, 
$standAlone );
-                       if ( strlen( $content ) == 0 ) {
+                       if ( preg_match( 
"/<centralnotice-template-\w{1,}>\z/", $content ) ) {
+                               echo "<!-- Failed cache lookup -->";
+                       } elseif ( strlen( $content ) == 0 ) {
                                // Hack for IE/Mac 0-length keepalive problem, 
see RawPage.php
                                echo "<!-- Empty -->";
                        } else {
@@ -124,7 +126,7 @@
                $lang = Language::factory( $this->language );
                return $lang->formatNum( $num );
        }
-       
+
        /**
         * Retrieve a translated message
         * @param $msg The full name of the message
@@ -143,8 +145,11 @@
                $wgLang = $oldLang;
                
                // Replace variables in banner with values
-               $out = str_ireplace( '$amount', $this->formatNum( 
$this->getDonationAmount() ), $out );
-               $out = str_ireplace( '$sitename', $this->siteName, $out );
+               $amountSub = strpos( $out, '$amount');
+               if ( $amountSub !== false ) {
+                       $out = str_replace( '$amount', $this->formatNum( 
$this->getDonationAmount() ), $out );
+               }
+               $out = str_replace( '$sitename', $this->siteName, $out );
                
                return $out;
        }



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to