Commit 47f1f7f9 authored by Dries's avatar Dries
Browse files

- Patch #19609 by Daniel: fix problem with database prefixing

parent e722f0df
...@@ -60,17 +60,24 @@ function db_prefix_tables($sql) { ...@@ -60,17 +60,24 @@ function db_prefix_tables($sql) {
global $db_prefix; global $db_prefix;
if (is_array($db_prefix)) { if (is_array($db_prefix)) {
$prefix = $db_prefix['default']; if (array_key_exists('default', $db_prefix)) {
foreach ($db_prefix as $key => $val) { $tmp = $db_prefix;
if ($key !== 'default') { unset($tmp['default']);
foreach ($tmp as $key => $val) {
$sql = strtr($sql, array('{'. $key. '}' => $val. $key)); $sql = strtr($sql, array('{'. $key. '}' => $val. $key));
} }
return strtr($sql, array('{' => $db_prefix['default'], '}' => ''));
}
else {
foreach ($db_prefix as $key => $val) {
$sql = strtr($sql, array('{'. $key. '}' => $val. $key));
}
return strtr($sql, array('{' => '', '}' => ''));
} }
} }
else { else {
$prefix = $db_prefix; return strtr($sql, array('{' => $db_prefix, '}' => ''));
} }
return strtr($sql, array('{' => $prefix, '}' => ''));
} }
/** /**
......
Supports Markdown
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