diff options
author | David M <davidmj@users.sourceforge.net> | 2007-05-05 21:47:16 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-05-05 21:47:16 +0000 |
commit | 921c9dd26ebce50ae7ea7e8a9b1082421e154744 (patch) | |
tree | 0e0b36eef0fe5c2e463a3965b1764a092ed9bb81 /phpBB/includes/acp/acp_database.php | |
parent | c8fa1399a94ef612a6fafde95aeb0c218be8711a (diff) | |
download | forums-921c9dd26ebce50ae7ea7e8a9b1082421e154744.tar forums-921c9dd26ebce50ae7ea7e8a9b1082421e154744.tar.gz forums-921c9dd26ebce50ae7ea7e8a9b1082421e154744.tar.bz2 forums-921c9dd26ebce50ae7ea7e8a9b1082421e154744.tar.xz forums-921c9dd26ebce50ae7ea7e8a9b1082421e154744.zip |
I *knew* I forgot something :P
git-svn-id: file:///svn/phpbb/trunk@7479 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_database.php')
-rw-r--r-- | phpBB/includes/acp/acp_database.php | 226 |
1 files changed, 114 insertions, 112 deletions
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index e86477ed43..b09caa6fc0 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -230,148 +230,150 @@ class acp_database } else { - confirm_box(false, 'DELETE_SELECTED_BACKUP', build_hidden_fields(array('delete' => $delete, 'file' => $file))); + confirm_box(false, $user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); } } - - $download = request_var('download', ''); - - if ($download) + else { - $name = $matches[0]; + $download = request_var('download', ''); - switch ($matches[1]) + if ($download) { - case 'sql': - $mimetype = 'text/x-sql'; - break; - case 'sql.bz2': - $mimetype = 'application/x-bzip2'; - break; - case 'sql.gz': - $mimetype = 'application/x-gzip'; - break; - } + $name = $matches[0]; - header('Pragma: no-cache'); - header("Content-Type: $mimetype; name=\"$name\""); - header("Content-disposition: attachment; filename=$name"); + switch ($matches[1]) + { + case 'sql': + $mimetype = 'text/x-sql'; + break; + case 'sql.bz2': + $mimetype = 'application/x-bzip2'; + break; + case 'sql.gz': + $mimetype = 'application/x-gzip'; + break; + } - @set_time_limit(0); + header('Pragma: no-cache'); + header("Content-Type: $mimetype; name=\"$name\""); + header("Content-disposition: attachment; filename=$name"); - $fp = @fopen($file_name, 'rb'); + @set_time_limit(0); - if ($fp !== false) - { - while (!feof($fp)) + $fp = @fopen($file_name, 'rb'); + + if ($fp !== false) { - echo fread($fp, 8192); + while (!feof($fp)) + { + echo fread($fp, 8192); + } + fclose($fp); } - fclose($fp); - } - flush(); - exit; - } + flush(); + exit; + } - switch ($matches[1]) - { - case 'sql': - $fp = fopen($file_name, 'rb'); - $read = 'fread'; - $seek = 'fseek'; - $eof = 'feof'; - $close = 'fclose'; - $fgetd = 'fgetd'; - break; + switch ($matches[1]) + { + case 'sql': + $fp = fopen($file_name, 'rb'); + $read = 'fread'; + $seek = 'fseek'; + $eof = 'feof'; + $close = 'fclose'; + $fgetd = 'fgetd'; + break; - case 'sql.bz2': - $fp = bzopen($file_name, 'r'); - $read = 'bzread'; - $seek = ''; - $eof = 'feof'; - $close = 'bzclose'; - $fgetd = 'fgetd_seekless'; - break; + case 'sql.bz2': + $fp = bzopen($file_name, 'r'); + $read = 'bzread'; + $seek = ''; + $eof = 'feof'; + $close = 'bzclose'; + $fgetd = 'fgetd_seekless'; + break; - case 'sql.gz': - $fp = gzopen($file_name, 'rb'); - $read = 'gzread'; - $seek = 'gzseek'; - $eof = 'gzeof'; - $close = 'gzclose'; - $fgetd = 'fgetd'; - break; - } + case 'sql.gz': + $fp = gzopen($file_name, 'rb'); + $read = 'gzread'; + $seek = 'gzseek'; + $eof = 'gzeof'; + $close = 'gzclose'; + $fgetd = 'fgetd'; + break; + } - switch ($db->sql_layer) - { - case 'mysql': - case 'mysql4': - case 'mysqli': - case 'sqlite': - while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) - { - $db->sql_query($sql); - } - break; + switch ($db->sql_layer) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + case 'sqlite': + while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; - case 'firebird': - $delim = ";\n"; - while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) - { - $query = trim($sql); - if (substr($query, 0, 8) === 'SET TERM') + case 'firebird': + $delim = ";\n"; + while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) { - $delim = $query[9] . "\n"; - continue; + $query = trim($sql); + if (substr($query, 0, 8) === 'SET TERM') + { + $delim = $query[9] . "\n"; + continue; + } + $db->sql_query($query); } - $db->sql_query($query); - } - break; + break; - case 'postgres': - while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) - { - $query = trim($sql); - $db->sql_query($query); - if (substr($query, 0, 4) == 'COPY') + case 'postgres': + while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) { - while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.') + $query = trim($sql); + $db->sql_query($query); + if (substr($query, 0, 4) == 'COPY') { - if ($sub === false) + while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.') { - trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action)); + if ($sub === false) + { + trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action)); + } + pg_put_line($db->db_connect_id, $sub . "\n"); } - pg_put_line($db->db_connect_id, $sub . "\n"); + pg_put_line($db->db_connect_id, "\\.\n"); + pg_end_copy($db->db_connect_id); } - pg_put_line($db->db_connect_id, "\\.\n"); - pg_end_copy($db->db_connect_id); } - } - break; + break; - case 'oracle': - while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false) - { - $db->sql_query($sql); - } - break; + case 'oracle': + while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; - case 'mssql': - case 'mssql_odbc': - while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) - { - $db->sql_query($sql); - } - break; - } + case 'mssql': + case 'mssql_odbc': + while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + } - $close($fp); + $close($fp); - add_log('admin', 'LOG_DB_RESTORE'); - trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); - break; + add_log('admin', 'LOG_DB_RESTORE'); + trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); + break; + } default: $methods = array('sql'); |