make ORMRow compatible with load balancer, replace usage of wfGetDB( DB_MASTER )
authoraude <aude.wiki@gmail.com>
Mon, 5 Nov 2012 19:57:47 +0000 (20:57 +0100)
committeraude <aude.wiki@gmail.com>
Mon, 5 Nov 2012 19:57:47 +0000 (20:57 +0100)
Change-Id: Ic9e728f8d2f83906fee6c4877296ad0759a7b539

includes/db/ORMRow.php

index fa25868..1753afe 100644 (file)
@@ -347,7 +347,7 @@ abstract class ORMRow implements IORMRow {
         * @return boolean Success indicator
         */
        protected function saveExisting( $functionName = null ) {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $success = $dbw->update(
                        $this->table->getName(),
@@ -383,7 +383,7 @@ abstract class ORMRow implements IORMRow {
         * @return boolean Success indicator
         */
        protected function insert( $functionName = null, array $options = null ) {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $success = $dbw->insert(
                        $this->table->getName(),
@@ -558,7 +558,7 @@ abstract class ORMRow implements IORMRow {
                $absoluteAmount = abs( $amount );
                $isNegative = $amount < 0;
 
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->table->getWriteDbConnection();
 
                $fullField = $this->table->getPrefixedField( $field );