Index: trunk/extensions/Contest/specials/SpecialContestant.php |
— | — | @@ -46,6 +46,10 @@ |
47 | 47 | $this->handleSubmission( $contestant->getId() ); |
48 | 48 | } |
49 | 49 | |
| 50 | + if ( $this->getRequest()->wasPosted() ) { |
| 51 | + $contestant->setReadDb( DB_MASTER ); |
| 52 | + } |
| 53 | + |
50 | 54 | $contestant->loadFields(); |
51 | 55 | $this->showPage( $contestant ); |
52 | 56 | } |
Index: trunk/extensions/Contest/includes/ContestDBObject.php |
— | — | @@ -23,6 +23,14 @@ |
24 | 24 | * @var array |
25 | 25 | */ |
26 | 26 | protected $fields = array( 'id' => null ); |
| 27 | + |
| 28 | + /** |
| 29 | + * The database connection to use for read operations. |
| 30 | + * |
| 31 | + * @since 0.2 |
| 32 | + * @var integer DB_ enum |
| 33 | + */ |
| 34 | + protected $readDb = DB_SLAVE; |
27 | 35 | |
28 | 36 | /** |
29 | 37 | * Constructor. |
— | — | @@ -273,8 +281,29 @@ |
274 | 282 | return $this->insertIntoDB(); |
275 | 283 | } |
276 | 284 | } |
277 | | - |
| 285 | + |
278 | 286 | /** |
| 287 | + * Get the database type used for read operations. |
| 288 | + * |
| 289 | + * @since 0.2 |
| 290 | + * @return integer DB_ enum |
| 291 | + */ |
| 292 | + public function getReadDb() { |
| 293 | + return $this->readDb; |
| 294 | + } |
| 295 | + |
| 296 | + /** |
| 297 | + * Set the database type to use for read operations. |
| 298 | + * |
| 299 | + * @param integer $db |
| 300 | + * |
| 301 | + * @since 0.2 |
| 302 | + */ |
| 303 | + public function setReadDb( $db ) { |
| 304 | + $this->readDb = $db; |
| 305 | + } |
| 306 | + |
| 307 | + /** |
279 | 308 | * Updates the object in the database. |
280 | 309 | * |
281 | 310 | * @since 0.1 |
— | — | @@ -710,7 +739,7 @@ |
711 | 740 | * @return ResultWrapper |
712 | 741 | */ |
713 | 742 | public function rawSelect( $fields = null, array $conditions = array(), array $options = array() ) { |
714 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 743 | + $dbr = wfGetDB( $this->getReadDb() ); |
715 | 744 | |
716 | 745 | return $dbr->select( |
717 | 746 | $this->getDBTable(), |