diff options
author | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 02:57:52 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 02:57:52 +0100 |
commit | 034cf19159c828d242fbb3128fda6db815a75ca6 (patch) | |
tree | 1a1e62e109c5ae51e174c910b4861c584b15f573 /lib/db.php | |
parent | 010bfa11e363928f4c3a6d8518cbab0e79e28149 (diff) | |
download | nextcloud-server-034cf19159c828d242fbb3128fda6db815a75ca6.tar.gz nextcloud-server-034cf19159c828d242fbb3128fda6db815a75ca6.zip |
allow changing database backends between PDO and MDB2
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/db.php b/lib/db.php index 05ed8398b7b..58a478ba0c0 100644 --- a/lib/db.php +++ b/lib/db.php @@ -71,7 +71,14 @@ class OC_DB { /** * connect to the database using pdo */ - private static function connectPDO(){ + public static function connectPDO(){ + if(self::$connection){ + if(self::$backend==self::BACKEND_MDB2){ + self::disconnect(); + }else{ + return; + } + } // The global data we need $name = OC_Config::getValue( "dbname", "owncloud" ); $host = OC_Config::getValue( "dbhost", "" ); @@ -113,7 +120,14 @@ class OC_DB { /** * connect to the database using mdb2 */ - static private function connectMDB2(){ + public static function connectMDB2(){ + if(self::$connection){ + if(self::$backend==self::BACKEND_PDO){ + self::disconnect(); + }else{ + return; + } + } // The global data we need $name = OC_Config::getValue( "dbname", "owncloud" ); $host = OC_Config::getValue( "dbhost", "" ); @@ -255,8 +269,8 @@ class OC_DB { self::$connection->disconnect(); } self::$connection=false; - self::$mdb2=false; - self::$pdo=false; + self::$MDB2=false; + self::$PDO=false; } return true; @@ -374,6 +388,7 @@ class OC_DB { private static function connectScheme(){ // We need a mdb2 database connection self::connectMDB2(); + self::$MDB2->loadModule('Manager'); // Connect if this did not happen before if(!self::$schema){ |