Commit d35d0513 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Keep using the same db_type as the already initialized connection

parent 2a496cb7
......@@ -474,11 +474,14 @@ function provision_shell_exec() {
*/
function provision_set_active_db($new_db_url = NULL) {
static $old_db_url = NULL;
static $old_db_type = NULL;
global $db_url;
#initialize static
if (!$old_db_url) {
$old_db_url = $db_url;
preg_match("$^([a-z]*)://$", $old_db_url, $matches);
$old_db_type = $matches[1];
$db_url = array();
$db_url['default'] = $old_db_url;
}
......@@ -486,8 +489,8 @@ function provision_set_active_db($new_db_url = NULL) {
if ($new_db_url) {
preg_match("$^([a-z]*)://$", $new_db_url, $matches);
if ($matches[1] != PROVISION_DB_TYPE) {
$new_db_url = preg_replace("/^" .$matches[1]. "/", PROVISION_DB_TYPE, $new_db_url);
if ($matches[1] != $old_db_type) {
$new_db_url = preg_replace("/^" .$matches[1]. "/", $old_db_type, $new_db_url);
}
$db_url[md5($new_db_url)] = $new_db_url;
db_set_active(md5($new_db_url));
......@@ -497,6 +500,7 @@ function provision_set_active_db($new_db_url = NULL) {
}
}
/**
* Close an active connection
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment