Index: trunk/extensions/Contest/specials/SpecialContestant.php |
— | — | @@ -50,10 +50,12 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | if ( $this->getRequest()->wasPosted() ) { |
54 | | - $contestant->setReadDb( DB_MASTER ); |
| 54 | + ContestContestant::s()->setReadDb( DB_MASTER ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | $contestant->loadFields(); |
| 58 | + ContestContestant::s()->setReadDb( DB_SLAVE ); |
| 59 | + |
58 | 60 | $this->showPage( $contestant ); |
59 | 61 | } |
60 | 62 | } |
— | — | @@ -295,7 +297,14 @@ |
296 | 298 | |
297 | 299 | $out->addHTML( '<div class="contestant-comments">' ); |
298 | 300 | |
299 | | - foreach ( $contestant->getComments() as /* ContestComment */ $comment ) { |
| 301 | + if ( $this->getRequest()->wasPosted() ) { |
| 302 | + ContestComment::s()->setReadDb( DB_MASTER ); |
| 303 | + } |
| 304 | + |
| 305 | + $comments = $contestant->getComments(); |
| 306 | + ContestComment::s()->setReadDb( DB_SLAVE ); |
| 307 | + |
| 308 | + foreach ( $comments as /* ContestComment */ $comment ) { |
300 | 309 | $out->addHTML( $this->getCommentHTML( $comment ) ); |
301 | 310 | } |
302 | 311 | |
Index: trunk/extensions/Contest/includes/ContestDBObject.php |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | * @since 0.2 |
32 | 32 | * @var integer DB_ enum |
33 | 33 | */ |
34 | | - protected $readDb = DB_SLAVE; |
35 | | - |
| 34 | + protected static $readDb = DB_SLAVE; |
| 35 | + |
36 | 36 | /** |
37 | 37 | * Constructor. |
38 | 38 | * |
— | — | @@ -283,27 +283,6 @@ |
284 | 284 | } |
285 | 285 | |
286 | 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 | | - /** |
308 | 287 | * Updates the object in the database. |
309 | 288 | * |
310 | 289 | * @since 0.1 |
— | — | @@ -481,6 +460,27 @@ |
482 | 461 | // |
483 | 462 | |
484 | 463 | /** |
| 464 | + * Get the database type used for read operations. |
| 465 | + * |
| 466 | + * @since 0.2 |
| 467 | + * @return integer DB_ enum |
| 468 | + */ |
| 469 | + public function getReadDb() { |
| 470 | + return self::$readDb; |
| 471 | + } |
| 472 | + |
| 473 | + /** |
| 474 | + * Set the database type to use for read operations. |
| 475 | + * |
| 476 | + * @param integer $db |
| 477 | + * |
| 478 | + * @since 0.2 |
| 479 | + */ |
| 480 | + public function setReadDb( $db ) { |
| 481 | + self::$readDb = $db; |
| 482 | + } |
| 483 | + |
| 484 | + /** |
485 | 485 | * Gets if the object can take a certain field. |
486 | 486 | * |
487 | 487 | * @since 0.1 |