Index: trunk/phase3/includes/BagOStuff.php |
— | — | @@ -221,10 +221,19 @@ |
222 | 222 | var $lastExpireAll = 0; |
223 | 223 | |
224 | 224 | protected function getDB() { |
225 | | - if ( !isset( $this->lb ) ) { |
226 | | - $this->lb = wfGetLBFactory()->newMainLB(); |
227 | | - $this->db = $this->lb->getConnection( DB_MASTER ); |
228 | | - $this->db->clearFlag( DBO_TRX ); |
| 225 | + global $wgDBtype; |
| 226 | + if ( !isset( $this->db ) ) { |
| 227 | + /* We must keep a separate connection to MySQL in order to avoid deadlocks |
| 228 | + * However, SQLite has an opposite behaviour. |
| 229 | + * @todo Investigate behaviour for other databases |
| 230 | + */ |
| 231 | + if ( $wgDBtype == 'sqlite' ) { |
| 232 | + $this->db = wfGetDB( DB_MASTER ); |
| 233 | + } else { |
| 234 | + $this->lb = wfGetLBFactory()->newMainLB(); |
| 235 | + $this->db = $this->lb->getConnection( DB_MASTER ); |
| 236 | + $this->db->clearFlag( DBO_TRX ); |
| 237 | + } |
229 | 238 | } |
230 | 239 | return $this->db; |
231 | 240 | } |