]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/BagOStuff.php
MediaWiki 1.15.3
[autoinstallsdev/mediawiki.git] / includes / BagOStuff.php
index 572dca6c416cbcc2e609f1cbc38f11491dc19cdb..ffa8a0bbcaf81120b749212652473089f2f8daf1 100644 (file)
@@ -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;
        }