Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -156,7 +156,6 @@ |
157 | 157 | 'centralnotice-off' => 'off', |
158 | 158 | 'centralnotice-added' => 'Added <span class="cn-new-value">$1</span>', |
159 | 159 | 'centralnotice-removed' => 'Removed <span class="cn-old-value">$1</span>', |
160 | | - 'centralnotice-banners-changed' => 'Banner assignments were changed', |
161 | 160 | 'centralnotice-no-assignments' => 'no banners assigned', |
162 | 161 | 'centralnotice-talk-link' => 'talk', |
163 | 162 | 'centralnotice-user-links' => '$1 ($2)', |
Index: trunk/extensions/CentralNotice/CentralNotice.db.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | $campaign['languages'] = implode( ", ", $languages ); |
171 | 171 | $campaign['countries'] = implode( ", ", $geo_countries ); |
172 | 172 | |
173 | | - $bannersIn = CentralNoticeDB::getCampaignBanners( $row->not_id ); |
| 173 | + $bannersIn = CentralNoticeDB::getCampaignBanners( $row->not_id, true ); |
174 | 174 | $bannersOut = array(); |
175 | 175 | // All we want are the banner names and weights |
176 | 176 | foreach ( $bannersIn as $key => $row ) { |
— | — | @@ -185,13 +185,19 @@ |
186 | 186 | |
187 | 187 | /* |
188 | 188 | * 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) |
190 | 191 | * @return a 2D array of banners with associated weights and settings |
191 | 192 | */ |
192 | | - static function getCampaignBanners( $campaigns ) { |
| 193 | + static function getCampaignBanners( $campaigns, $logging = false ) { |
193 | 194 | global $wgCentralDBname; |
194 | 195 | |
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 | + } |
196 | 202 | |
197 | 203 | $banners = array(); |
198 | 204 | |