r100402 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100401‎ | r100402 | r100403 >
Date:01:53, 21 October 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
use master db after submission so results do not get omitted due to rep lag
Modified paths:
  • /trunk/extensions/Contest/includes/ContestDBObject.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestant.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialContestant.php
@@ -46,6 +46,10 @@
4747 $this->handleSubmission( $contestant->getId() );
4848 }
4949
 50+ if ( $this->getRequest()->wasPosted() ) {
 51+ $contestant->setReadDb( DB_MASTER );
 52+ }
 53+
5054 $contestant->loadFields();
5155 $this->showPage( $contestant );
5256 }
Index: trunk/extensions/Contest/includes/ContestDBObject.php
@@ -23,6 +23,14 @@
2424 * @var array
2525 */
2626 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;
2735
2836 /**
2937 * Constructor.
@@ -273,8 +281,29 @@
274282 return $this->insertIntoDB();
275283 }
276284 }
277 -
 285+
278286 /**
 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+ /**
279308 * Updates the object in the database.
280309 *
281310 * @since 0.1
@@ -710,7 +739,7 @@
711740 * @return ResultWrapper
712741 */
713742 public function rawSelect( $fields = null, array $conditions = array(), array $options = array() ) {
714 - $dbr = wfGetDB( DB_SLAVE );
 743+ $dbr = wfGetDB( $this->getReadDb() );
715744
716745 return $dbr->select(
717746 $this->getDBTable(),

Follow-up revisions

RevisionCommit summaryAuthorDate
r1004031.18wmf1 MFT r100399, r100402reedy01:59, 21 October 2011
r100427Follow up to r100402;jeroendedauw16:22, 21 October 2011
r1004401.18wmf1 REL r100402, r100405, r100419, r100427, r100432, r100433, r100435, r...reedy19:22, 21 October 2011

Status & tagging log