Commit aecd3161 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#168315 by schuyler1d: previous active database name was not consistently...

#168315 by schuyler1d: previous active database name was not consistently returned in db_set_active()
parent d2fddb47
......@@ -123,7 +123,7 @@ function db_prefix_tables($sql) {
*/
function db_set_active($name = 'default') {
global $db_url, $db_type, $active_db;
static $db_conns;
static $db_conns, $active_name = FALSE;
if (empty($db_url)) {
include_once 'includes/install.inc';
......@@ -152,11 +152,12 @@ function db_set_active($name = 'default') {
$db_conns[$name] = db_connect($connect_url);
}
$previous_db = $active_db;
$previous_name = $active_name;
// Set the active connection.
$active_name = $name;
$active_db = $db_conns[$name];
return array_search($previous_db, $db_conns);
return $previous_name;
}
/**
......
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