1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

DB-Backup Quick memory-issue fix.

This commit is contained in:
CaMer0n
2012-07-31 08:24:21 +00:00
parent c7d1b78673
commit cc3ede95be

View File

@@ -114,14 +114,18 @@ class _system_cron
$text .= $row2['Create Table'];
$text .= ";\n\n";
$sql->db_Select_gen("SELECT * FROM `".$table."`");
$data_array = array();
ob_end_clean(); // prevent memory exhaustian
$count = $sql->db_Select_gen("SELECT * FROM `".$table."`");
$data_array = "";
while($row = $sql->db_Fetch())
{
if(!$fields)
{
$fields = array_keys($row);
$fields = array_keys($row);
$text = "\nINSERT INTO `".$table."` (`".implode("` ,`",$fields)."`) VALUES \n";
file_put_contents($backupFile,$text,FILE_APPEND);
}
$d = array();
@@ -130,14 +134,12 @@ class _system_cron
$d[] = "'".mysql_real_escape_string($row[$val])."'";
}
$data_array[] = "(".implode(", ",$d).")";
$data_array = "(".implode(", ",$d)."),\n"; //XXX extra ',' at the end may be an issue. - to be tested.
file_put_contents($backupFile,$data_array,FILE_APPEND);
}
$text .= "\nINSERT INTO `".$table."` (`".implode("` ,`",$fields)."`) VALUES \n";
$text .= implode(",\n",$data_array);
$text .= ";\n\n\n";
$text = ";\n\n\n";
$c++;
file_put_contents($backupFile,$text,FILE_APPEND);