Debug php backup for new mysql version
This commit is contained in:
parent
2458244ee3
commit
081d31a56e
@ -214,10 +214,13 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>
|
||||
<div class="formelementrow"><input type="checkbox" name="disable_fk"
|
||||
value="yes" id="checkbox_disable_fk" checked /> <label
|
||||
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label>
|
||||
|
||||
<select name="sql_compat" id="select_sql_compat" class="flat">
|
||||
@ -286,11 +289,12 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
|
||||
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>
|
||||
<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
|
||||
value="yes" id="checkbox_disable_fk" checked /> <label
|
||||
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
|
||||
@ -254,7 +254,7 @@ function backup_tables($outputfile, $tables='*')
|
||||
global $errormsg;
|
||||
|
||||
// Set to UTF-8
|
||||
if(is_a($db, 'DoliDBMysqli')) {
|
||||
if (is_a($db, 'DoliDBMysqli')) {
|
||||
/** @var DoliDBMysqli $db */
|
||||
$db->db->set_charset('utf8');
|
||||
} else {
|
||||
@ -300,11 +300,17 @@ function backup_tables($outputfile, $tables='*')
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
";
|
||||
|
||||
if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n";
|
||||
$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
|
||||
//$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
|
||||
if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n";
|
||||
|
||||
fwrite($handle, $sqlhead);
|
||||
@ -321,8 +327,8 @@ function backup_tables($outputfile, $tables='*')
|
||||
fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n");
|
||||
|
||||
if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it
|
||||
//fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
||||
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
||||
fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
||||
fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
||||
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
|
||||
$row2 = $db->fetch_row($resqldrop);
|
||||
if (empty($row2[1]))
|
||||
@ -338,6 +344,7 @@ function backup_tables($outputfile, $tables='*')
|
||||
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_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
|
||||
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
||||
|
||||
$sql='SELECT * FROM '.$table;
|
||||
$result = $db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user