Skip to content
Snippets Groups Projects
Commit 099cb590 authored by Frédéric G. Marand's avatar Frédéric G. Marand Committed by Colan Schwartz
Browse files

Issue #1223858 by fgm: Add support for database prefixes.

parent d3815083
Branches
Tags
No related merge requests found
......@@ -162,6 +162,14 @@ function schema_unprefix_table($name) {
elseif (!empty($db_prefix) && preg_match('@^' . $db_prefix . '(.*)@', $name, $m)) {
return $m[1];
}
elseif (empty($_db_prefix)) {
$info = Database::getConnectionInfo($connection = 'default'); // FIXME: obtain the correct connection
$_db_prefix = empty($info['default']['prefix'])
? ''
: reset($info['default']['prefix']);
$db_prefix = $_db_prefix;
$name = drupal_substr($name, drupal_strlen($_db_prefix));
}
return $name;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment