summaryrefslogtreecommitdiff
path: root/includes/BagOStuff.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/BagOStuff.php')
-rw-r--r--includes/BagOStuff.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php
index 572dca6c..ffa8a0bb 100644
--- a/includes/BagOStuff.php
+++ b/includes/BagOStuff.php
@@ -437,10 +437,19 @@ class MediaWikiBagOStuff extends SqlBagOStuff {
var $lb, $db;
function _getDB(){
- if ( !isset( $this->lb ) ) {
- $this->lb = wfGetLBFactory()->newMainLB();
- $this->db = $this->lb->getConnection( DB_MASTER );
- $this->db->clearFlag( DBO_TRX );
+ global $wgDBtype;
+ if ( !isset( $this->db ) ) {
+ /* We must keep a separate connection to MySQL in order to avoid deadlocks
+ * However, SQLite has an opposite behaviour.
+ * @todo Investigate behaviour for other databases
+ */
+ if ( $wgDBtype == 'sqlite' ) {
+ $this->db = wfGetDB( DB_MASTER );
+ } else {
+ $this->lb = wfGetLBFactory()->newMainLB();
+ $this->db = $this->lb->getConnection( DB_MASTER );
+ $this->db->clearFlag( DBO_TRX );
+ }
}
return $this->db;
}