Commit 07c0ad07 authored by smk-ka's avatar smk-ka

Fixed the generation of the table list for multiple database prefixes.

parent b4129968
......@@ -6,6 +6,8 @@ Demo x.x-x.x, xxxx-xx-xx
Demo 5.x-1.x, xxxx-xx-xx
------------------------
by smk-ka: Fixed the generation of the table list for multiple database
prefixes.
Demo 5.x-1.3, 2008-02-24
......
......@@ -530,7 +530,7 @@ function demo_enum_tables() {
if (is_array($db_prefix)) {
// Create a regular expression for table prefix matching.
$rx = '/^('. implode('|', array_filter($db_prefix)) .')/';
$rx = '/^'. implode('|', array_filter($db_prefix)) .'/';
}
else if ($db_prefix != '') {
$rx = '/^'. $db_prefix .'/';
......@@ -549,12 +549,11 @@ function demo_enum_tables() {
while ($table = db_fetch_array($result)) {
$table = reset($table);
if (is_array($db_prefix)) {
// Check if table matches any configured prefix.
if (preg_match($rx, $table)) {
// One arbitrary prefix matched, now let's find out which one.
$plain_table = preg_replace($rx, '', $table);
$table_prefix = substr($table, 0, strlen($table) - strlen($plain_table));
if ($db_prefix[$plain_table] == $table_prefix) {
// Check if table name matches a configured prefix.
if (preg_match($rx, $table, $matches)) {
$table_prefix = $matches[0];
$plain_table = substr($table, strlen($table_prefix));
if ($db_prefix[$plain_table] == $table_prefix || $db_prefix['default'] == $table_prefix) {
$tables[] = $table;
}
}
......
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