Fix: deleting files into backup system tools.
Fix: Dump using php not not include lock on tables that are deleted.
This commit is contained in:
parent
95793a5475
commit
ed49f88446
@ -50,7 +50,7 @@ if (! $user->admin)
|
|||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
|
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||||
$ret=dol_delete_file($file, 1);
|
$ret=dol_delete_file($file, 1);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
|
|||||||
@ -58,7 +58,7 @@ if ($file && ! $what)
|
|||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
|
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||||
$ret=dol_delete_file($file, 1);
|
$ret=dol_delete_file($file, 1);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
@ -451,10 +451,15 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
||||||
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
|
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
|
||||||
$row2 = $db->fetch_row($resqldrop);
|
$row2 = $db->fetch_row($resqldrop);
|
||||||
|
if (empty($row2[1]))
|
||||||
|
{
|
||||||
|
fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fwrite($handle,$row2[1].";\n");
|
fwrite($handle,$row2[1].";\n");
|
||||||
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
|
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
|
||||||
|
|
||||||
|
|
||||||
// Dumping the data (locking the table and disabling the keys check while doing the process)
|
// Dumping the data (locking the table and disabling the keys check while doing the process)
|
||||||
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
|
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
|
||||||
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
|
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
|
||||||
@ -463,7 +468,8 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
$sql='SELECT * FROM '.$table;
|
$sql='SELECT * FROM '.$table;
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$num_fields = $db->num_rows($result);
|
$num_fields = $db->num_rows($result);
|
||||||
while($row = $db->fetch_row($result)) {
|
while($row = $db->fetch_row($result))
|
||||||
|
{
|
||||||
// For each row of data we print a line of INSERT
|
// For each row of data we print a line of INSERT
|
||||||
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
|
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
|
||||||
$columns = count($row);
|
$columns = count($row);
|
||||||
@ -490,6 +496,7 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
|
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
|
||||||
fwrite($handle,"\n\n\n");
|
fwrite($handle,"\n\n\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Backup Procedure structure*/
|
/* Backup Procedure structure*/
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user