r93443 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93442‎ | r93443 | r93444 >
Date:01:11, 29 July 2011
Author:kaldari
Status:ok
Tags:
Comment:
removing unused message, fixing another concurrency problem
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.db.php (modified) (history)
  • /trunk/extensions/CentralNotice/CentralNotice.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php
@@ -156,7 +156,6 @@
157157 'centralnotice-off' => 'off',
158158 'centralnotice-added' => 'Added <span class="cn-new-value">$1</span>',
159159 'centralnotice-removed' => 'Removed <span class="cn-old-value">$1</span>',
160 - 'centralnotice-banners-changed' => 'Banner assignments were changed',
161160 'centralnotice-no-assignments' => 'no banners assigned',
162161 'centralnotice-talk-link' => 'talk',
163162 'centralnotice-user-links' => '$1 ($2)',
Index: trunk/extensions/CentralNotice/CentralNotice.db.php
@@ -169,7 +169,7 @@
170170 $campaign['languages'] = implode( ", ", $languages );
171171 $campaign['countries'] = implode( ", ", $geo_countries );
172172
173 - $bannersIn = CentralNoticeDB::getCampaignBanners( $row->not_id );
 173+ $bannersIn = CentralNoticeDB::getCampaignBanners( $row->not_id, true );
174174 $bannersOut = array();
175175 // All we want are the banner names and weights
176176 foreach ( $bannersIn as $key => $row ) {
@@ -185,13 +185,19 @@
186186
187187 /*
188188 * Given one or more campaign ids, return all banners bound to them
189 - * @param $campaigns An array of id numbers
 189+ * @param $campaigns array of id numbers
 190+ * @param $logging boolean whether or not request is for logging (optional)
190191 * @return a 2D array of banners with associated weights and settings
191192 */
192 - static function getCampaignBanners( $campaigns ) {
 193+ static function getCampaignBanners( $campaigns, $logging = false ) {
193194 global $wgCentralDBname;
194195
195 - $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
 196+ // If logging, read from the master database to avoid concurrency problems
 197+ if ( $logging ) {
 198+ $dbr = wfGetDB( DB_MASTER, array(), $wgCentralDBname );
 199+ } else {
 200+ $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
 201+ }
196202
197203 $banners = array();
198204

Status & tagging log