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

Revision: 93443
Author:   kaldari
Date:     2011-07-29 01:11:05 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
removing unused message, fixing another concurrency problem

Modified Paths:
--------------
    trunk/extensions/CentralNotice/CentralNotice.db.php
    trunk/extensions/CentralNotice/CentralNotice.i18n.php

Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2011-07-28 23:57:08 UTC 
(rev 93442)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2011-07-29 01:11:05 UTC 
(rev 93443)
@@ -169,7 +169,7 @@
                        $campaign['languages'] = implode( ", ", $languages );
                        $campaign['countries'] = implode( ", ", $geo_countries 
);
                        
-                       $bannersIn = CentralNoticeDB::getCampaignBanners( 
$row->not_id );
+                       $bannersIn = CentralNoticeDB::getCampaignBanners( 
$row->not_id, true );
                        $bannersOut = array();
                        // All we want are the banner names and weights
                        foreach ( $bannersIn as $key => $row ) {
@@ -185,13 +185,19 @@
 
        /*
         * Given one or more campaign ids, return all banners bound to them
-        * @param $campaigns An array of id numbers
+        * @param $campaigns array of id numbers
+        * @param $logging boolean whether or not request is for logging 
(optional)
         * @return a 2D array of banners with associated weights and settings
         */
-       static function getCampaignBanners( $campaigns ) {
+       static function getCampaignBanners( $campaigns, $logging = false ) {
                global $wgCentralDBname;
                
-               $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
+               // If logging, read from the master database to avoid 
concurrency problems
+               if ( $logging ) {
+                       $dbr = wfGetDB( DB_MASTER, array(), $wgCentralDBname );
+               } else {
+                       $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
+               }
 
                $banners = array();
 

Modified: trunk/extensions/CentralNotice/CentralNotice.i18n.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.i18n.php       2011-07-28 
23:57:08 UTC (rev 93442)
+++ trunk/extensions/CentralNotice/CentralNotice.i18n.php       2011-07-29 
01:11:05 UTC (rev 93443)
@@ -156,7 +156,6 @@
        'centralnotice-off' => 'off',
        'centralnotice-added' => 'Added <span class="cn-new-value">$1</span>',
        'centralnotice-removed' => 'Removed <span 
class="cn-old-value">$1</span>',
-       'centralnotice-banners-changed' => 'Banner assignments were changed',
        'centralnotice-no-assignments' => 'no banners assigned',
        'centralnotice-talk-link' => 'talk',
        'centralnotice-user-links' => '$1 ($2)',


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to