Index: trunk/phase3/includes/ExternalStoreDB.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | */ |
20 | 20 | function &getLoadBalancer( $cluster ) { |
21 | 21 | $wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false; |
22 | | - |
| 22 | + |
23 | 23 | return wfGetLBFactory()->getExternalLB( $cluster, $wiki ); |
24 | 24 | } |
25 | 25 | |
— | — | @@ -29,8 +29,18 @@ |
30 | 30 | * @return DatabaseBase object |
31 | 31 | */ |
32 | 32 | function &getSlave( $cluster ) { |
| 33 | + global $wgDefaultExternalStore; |
| 34 | + |
33 | 35 | $wiki = isset($this->mParams['wiki']) ? $this->mParams['wiki'] : false; |
34 | 36 | $lb =& $this->getLoadBalancer( $cluster ); |
| 37 | + |
| 38 | + if ( !in_array( "DB://" . $cluster, $wgDefaultExternalStore ) ) { |
| 39 | + wfDebug( "read only external store" ); |
| 40 | + $lb->allowLagged(true); |
| 41 | + } else { |
| 42 | + wfDebug( "writable external store" ); |
| 43 | + } |
| 44 | + |
35 | 45 | return $lb->getConnection( DB_SLAVE, array(), $wiki ); |
36 | 46 | } |
37 | 47 | |
— | — | @@ -139,8 +149,8 @@ |
140 | 150 | function store( $cluster, $data ) { |
141 | 151 | $dbw = $this->getMaster( $cluster ); |
142 | 152 | $id = $dbw->nextSequenceValue( 'blob_blob_id_seq' ); |
143 | | - $dbw->insert( $this->getTable( $dbw ), |
144 | | - array( 'blob_id' => $id, 'blob_text' => $data ), |
| 153 | + $dbw->insert( $this->getTable( $dbw ), |
| 154 | + array( 'blob_id' => $id, 'blob_text' => $data ), |
145 | 155 | __METHOD__ ); |
146 | 156 | $id = $dbw->insertId(); |
147 | 157 | if ( !$id ) { |