Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
— | — | @@ -850,7 +850,7 @@ |
851 | 851 | return; |
852 | 852 | } |
853 | 853 | |
854 | | - $initialBannerSettings = CentralNoticeDB::getBannerSettings( $name ); |
| 854 | + $initialBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
855 | 855 | |
856 | 856 | $dbr = wfGetDB( DB_SLAVE ); |
857 | 857 | $res = $dbr->select( 'cn_templates', 'tmp_name', |
— | — | @@ -892,7 +892,7 @@ |
893 | 893 | } |
894 | 894 | |
895 | 895 | $bannerId = SpecialNoticeTemplate::getTemplateId( $name ); |
896 | | - $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name ); |
| 896 | + $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
897 | 897 | $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings, $contentChanged); |
898 | 898 | |
899 | 899 | return; |
Index: trunk/extensions/CentralNotice/CentralNotice.db.php |
— | — | @@ -243,14 +243,20 @@ |
244 | 244 | /** |
245 | 245 | * Return settings for a banner |
246 | 246 | * @param $bannerName string name of banner |
| 247 | + * @param $logging boolean whether or not request is for logging (optional) |
247 | 248 | * @return an array of banner settings |
248 | 249 | */ |
249 | | - static function getBannerSettings( $bannerName ) { |
| 250 | + static function getBannerSettings( $bannerName, $logging = false ) { |
250 | 251 | global $wgCentralDBname; |
251 | 252 | |
252 | 253 | $banner = array(); |
253 | 254 | |
254 | | - $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
| 255 | + // If logging, read from the master database to avoid concurrency problems |
| 256 | + if ( $logging ) { |
| 257 | + $dbr = wfGetDB( DB_MASTER, array(), $wgCentralDBname ); |
| 258 | + } else { |
| 259 | + $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |
| 260 | + } |
255 | 261 | |
256 | 262 | $row = $dbr->selectRow( 'cn_templates', |
257 | 263 | array( |