Skip to content
Snippets Groups Projects
Commit 47f1f7f9 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

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

parent e722f0df
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -60,17 +60,24 @@ function db_prefix_tables($sql) {
global $db_prefix;
if (is_array($db_prefix)) {
$prefix = $db_prefix['default'];
if (array_key_exists('default', $db_prefix)) {
$tmp = $db_prefix;
unset($tmp['default']);
foreach ($tmp as $key => $val) {
$sql = strtr($sql, array('{'. $key. '}' => $val. $key));
}
return strtr($sql, array('{' => $db_prefix['default'], '}' => ''));
}
else {
foreach ($db_prefix as $key => $val) {
if ($key !== 'default') {
$sql = strtr($sql, array('{'. $key. '}' => $val. $key));
}
return strtr($sql, array('{' => '', '}' => ''));
}
}
else {
$prefix = $db_prefix;
return strtr($sql, array('{' => $db_prefix, '}' => ''));
}
return strtr($sql, array('{' => $prefix, '}' => ''));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment