aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_database.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp/acp_database.php')
-rw-r--r--phpBB/includes/acp/acp_database.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index cd877ae31d..98c2decbf6 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -173,6 +173,7 @@ class acp_database
default:
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
$tables = get_tables($db);
+ asort($tables);
foreach ($tables as $table_name)
{
if (strlen($table_prefix) === 0 || stripos($table_name, $table_prefix) === 0)
@@ -346,7 +347,25 @@ class acp_database
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
{
$query = trim($sql);
- $db->sql_query($query);
+
+ if (substr($query, 0, 13) == 'CREATE DOMAIN')
+ {
+ list(, , $domain) = explode(' ', $query);
+ $sql = "SELECT domain_name
+ FROM information_schema.domains
+ WHERE domain_name = '$domain';";
+ $result = $db->sql_query($sql);
+ if (!$db->sql_fetchrow($result))
+ {
+ $db->sql_query($query);
+ }
+ $db->sql_freeresult($result);
+ }
+ else
+ {
+ $db->sql_query($query);
+ }
+
if (substr($query, 0, 4) == 'COPY')
{
while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.')
@@ -971,7 +990,7 @@ class postgres_extractor extends base_extractor
}
$sql_data = '-- Table: ' . $table_name . "\n";
- //$sql_data .= "DROP TABLE $table_name;\n";
+ $sql_data .= "DROP TABLE $table_name;\n";
// PGSQL does not "tightly" bind sequences and tables, we must guess...
$sql = "SELECT relname
FROM pg_class
@@ -1040,7 +1059,7 @@ class postgres_extractor extends base_extractor
$line .= ')';
}
- if (!empty($row['rowdefault']))
+ if (isset($row['rowdefault']))
{
$line .= ' DEFAULT ' . $row['rowdefault'];
}
@@ -2337,4 +2356,4 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
return false;
}
-?> \ No newline at end of file
+?>