Fixed GET continuation after timeot and logout page access without authorization.
[fa-stable.git] / admin / db / maintenance_db.inc
index 29790b6658ad29bebd26aa92dbd8d7fae718c479..e23595fc4c2ad27418bcb03e4d0dd725f80ee7fb 100644 (file)
@@ -117,7 +117,8 @@ function db_drop_db($connection)
 
 function db_import($filename, $connection, $force=true)
 {
-       global $db;
+       global $db, $go_debug;
+       
        $allowed_commands = array(
                "create"  => 'table_queries', 
                "alter table" => 'table_queries', 
@@ -191,13 +192,13 @@ function db_import($filename, $connection, $force=true)
        }
 */
        // execute drop tables if exists queries
-       if ($force && is_array($drop_queries))
+       if (is_array($drop_queries))
        {
                foreach($drop_queries as $drop_query)
                {
                        if (!db_query($drop_query[0]))
                        {
-                               if (!in_array(db_error_no(), $ignored_mysql_errors))
+                               if (!in_array(db_error_no(), $ignored_mysql_errors) || !$force)
                                        $sql_errors[] = array(db_error_msg($db), $drop_query[1]);
                        }
                }
@@ -297,6 +298,16 @@ function db_unzip($mode, $path)
        return explode("\n", $file_data);
 }
 
+function db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
+{
+       if ($conn['tbpref'] != "")
+               $filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
+       else
+               $filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
+
+       return db_export($conn, $filename, $ext, $comm, $tbpref);
+}
+
 // generates a dump of $db database
 // $drop and $zip tell if to include the drop table statement or dry to pack
 function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF)