summaryrefslogtreecommitdiff
path: root/includes/ExternalStoreDB.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/ExternalStoreDB.php')
-rw-r--r--includes/ExternalStoreDB.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/includes/ExternalStoreDB.php b/includes/ExternalStoreDB.php
index 877277a2..552c3109 100644
--- a/includes/ExternalStoreDB.php
+++ b/includes/ExternalStoreDB.php
@@ -18,7 +18,7 @@ class ExternalStoreDB {
*/
function &getLoadBalancer( $cluster ) {
$wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false;
-
+
return wfGetLBFactory()->getExternalLB( $cluster, $wiki );
}
@@ -29,8 +29,18 @@ class ExternalStoreDB {
* @return DatabaseBase object
*/
function &getSlave( $cluster ) {
+ global $wgDefaultExternalStore;
+
$wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false;
$lb =& $this->getLoadBalancer( $cluster );
+
+ if ( !in_array( "DB://" . $cluster, $wgDefaultExternalStore ) ) {
+ wfDebug( "read only external store" );
+ $lb->allowLagged(true);
+ } else {
+ wfDebug( "writable external store" );
+ }
+
return $lb->getConnection( DB_SLAVE, array(), $wiki );
}
@@ -139,8 +149,8 @@ class ExternalStoreDB {
function store( $cluster, $data ) {
$dbw = $this->getMaster( $cluster );
$id = $dbw->nextSequenceValue( 'blob_blob_id_seq' );
- $dbw->insert( $this->getTable( $dbw ),
- array( 'blob_id' => $id, 'blob_text' => $data ),
+ $dbw->insert( $this->getTable( $dbw ),
+ array( 'blob_id' => $id, 'blob_text' => $data ),
__METHOD__ );
$id = $dbw->insertId();
if ( !$id ) {