*/
function db_import($filename, $connection, $force=true, $init=true, $protect=false, $return_errors=false)
{
*/
function db_import($filename, $connection, $force=true, $init=true, $protect=false, $return_errors=false)
{
$allowed_commands = array(
"create" => 'table_queries',
$allowed_commands = array(
"create" => 'table_queries',
"drop table if exists" => 'drop_queries',
"drop function if exists" => 'drop_queries',
"drop trigger if exists" => 'drop_queries',
"drop table if exists" => 'drop_queries',
"drop function if exists" => 'drop_queries',
"drop trigger if exists" => 'drop_queries',
ini_set("max_execution_time", "180");
db_query("SET foreign_key_checks=0");
$check_line_len = false;
ini_set("max_execution_time", "180");
db_query("SET foreign_key_checks=0");
$check_line_len = false;
if (strpos($filename, ".gz") || strpos($filename, ".GZ"))
{ $lines = db_ungzip("lines", $filename);
$check_line_len = true;
if (strpos($filename, ".gz") || strpos($filename, ".GZ"))
{ $lines = db_ungzip("lines", $filename);
$check_line_len = true;
db_query("SET foreign_key_checks=1");
if ($delimiter != ';') db_query("delimiter ;"); // just for any case
db_query("SET foreign_key_checks=1");
if ($delimiter != ';') db_query("delimiter ;"); // just for any case
-function db_backup($conn, $ext='no', $comm='', $path=null)
+function db_backup($conn, $ext='no', $comm='', $path='')
{
if ($conn['tbpref'] != "")
$filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
else
$filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
{
if ($conn['tbpref'] != "")
$filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
else
$filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
return db_export($conn, $path . clean_file_name($filename), $ext, $comm);
}
//
return db_export($conn, $path . clean_file_name($filename), $ext, $comm);
}
//
function db_export($conn, $filename, $zip='no', $comment='')
{
function db_export($conn, $filename, $zip='no', $comment='')
{
//create comment
$out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n";
$out.="# Backup Date and Time: ".date("Y-m-d H:i")."\n";
//create comment
$out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n";
$out.="# Backup Date and Time: ".date("Y-m-d H:i")."\n";
$out.="# Company: ". @html_entity_decode($company, ENT_QUOTES, $_SESSION['language']->encoding)."\n";
$out.="# User: ".$_SESSION["wa_current_user"]->name."\n\n";
$out.="# Compatibility: ".get_company_pref('version_id')."\n\n";
$out.="# Company: ". @html_entity_decode($company, ENT_QUOTES, $_SESSION['language']->encoding)."\n";
$out.="# User: ".$_SESSION["wa_current_user"]->name."\n\n";
$out.="# Compatibility: ".get_company_pref('version_id')."\n\n";
// returns backup file name if name has changed (zip), else TRUE. If saving failed, return value is FALSE
function save_to_file($path, $zip, $fileData)
{
// returns backup file name if name has changed (zip), else TRUE. If saving failed, return value is FALSE
function save_to_file($path, $zip, $fileData)
{