mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
* MySQL 8.0: fix DB backup recorded Int columns as TinyInt and stalls restore
* MySQL 8.0: timestamp columns had no default and did not update automatic
This commit is contained in:
parent
a767bdef1e
commit
75c07334df
@ -505,9 +505,10 @@ class Backup
|
|||||||
*
|
*
|
||||||
* @param resource $f file opened with fopen for reading
|
* @param resource $f file opened with fopen for reading
|
||||||
* @param int|string $insert_n_rows =500 how many rows to insert in one sql statement, or string with column-name used as unique key for insert
|
* @param int|string $insert_n_rows =500 how many rows to insert in one sql statement, or string with column-name used as unique key for insert
|
||||||
|
* @param bool $only_egw=false true: only restore egw_* tables, setting this to true often helps to import/update ancient EGroupware dumps
|
||||||
* @returns int number of rows read from csv file
|
* @returns int number of rows read from csv file
|
||||||
*/
|
*/
|
||||||
function db_restore($f, $insert_n_rows=500)
|
function db_restore($f, $insert_n_rows=500, bool $only_egw=false)
|
||||||
{
|
{
|
||||||
$convert_to_system_charset = true;
|
$convert_to_system_charset = true;
|
||||||
$table = null;
|
$table = null;
|
||||||
@ -560,7 +561,10 @@ class Backup
|
|||||||
}
|
}
|
||||||
unset($def);
|
unset($def);
|
||||||
//echo "<pre>$table_name => ".self::write_array($schema,1)."</pre>\n";
|
//echo "<pre>$table_name => ".self::write_array($schema,1)."</pre>\n";
|
||||||
$this->schema_proc->CreateTable($table_name, $schema);
|
if (!$only_egw || preg_match('/^egw_/', $table_name))
|
||||||
|
{
|
||||||
|
$this->schema_proc->CreateTable($table_name, $schema);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -594,7 +598,7 @@ class Backup
|
|||||||
}
|
}
|
||||||
if ($table) // do we already reached the data part
|
if ($table) // do we already reached the data part
|
||||||
{
|
{
|
||||||
$import = true;
|
$import = !$only_egw || (bool)preg_match('/^egw_/', $table_name);
|
||||||
$data = self::csv_split($line, $cols, $blobs, $bools);
|
$data = self::csv_split($line, $cols, $blobs, $bools);
|
||||||
|
|
||||||
if ($table == 'egw_async' && in_array('##last-check-run##',$data))
|
if ($table == 'egw_async' && in_array('##last-check-run##',$data))
|
||||||
@ -882,7 +886,7 @@ class Backup
|
|||||||
//echo "function backup($f)<br>"; // !
|
//echo "function backup($f)<br>"; // !
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
$dir = $this->files_dir; // $GLOBALS['egw_info']['server']['files_dir'];
|
$dir = $this->files_dir; // $GLOBALS['egw_info']['server']['files_dir'];
|
||||||
// we may have to clean up old backup - left overs
|
// we may have to clean up old backup - leftovers
|
||||||
if (is_dir($dir.'/database_backup'))
|
if (is_dir($dir.'/database_backup'))
|
||||||
{
|
{
|
||||||
self::remove_dir_content($dir.'/database_backup/');
|
self::remove_dir_content($dir.'/database_backup/');
|
||||||
|
@ -1330,7 +1330,7 @@ class Schema
|
|||||||
{
|
{
|
||||||
$definition['fd'][$name]['precision'] = 8;
|
$definition['fd'][$name]['precision'] = 8;
|
||||||
}
|
}
|
||||||
elseif ($column->max_length > 6 || !$column->max_length)
|
elseif ($column->max_length > 6 || $column->max_length <= 0)
|
||||||
{
|
{
|
||||||
$definition['fd'][$name]['precision'] = 4;
|
$definition['fd'][$name]['precision'] = 4;
|
||||||
}
|
}
|
||||||
|
12
composer.lock
generated
12
composer.lock
generated
@ -799,16 +799,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "egroupware/adodb-php",
|
"name": "egroupware/adodb-php",
|
||||||
"version": "5.20.6",
|
"version": "5.20.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EGroupware/ADOdb.git",
|
"url": "https://github.com/EGroupware/ADOdb.git",
|
||||||
"reference": "c9a0b97038104af27336c2f752dc4216cbccf7bf"
|
"reference": "2bc7b262d9739c2869d53a120822fc6efeb63a44"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/EGroupware/ADOdb/zipball/c9a0b97038104af27336c2f752dc4216cbccf7bf",
|
"url": "https://api.github.com/repos/EGroupware/ADOdb/zipball/2bc7b262d9739c2869d53a120822fc6efeb63a44",
|
||||||
"reference": "c9a0b97038104af27336c2f752dc4216cbccf7bf",
|
"reference": "2bc7b262d9739c2869d53a120822fc6efeb63a44",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -853,7 +853,7 @@
|
|||||||
"issues": "https://github.com/ADOdb/ADOdb/issues",
|
"issues": "https://github.com/ADOdb/ADOdb/issues",
|
||||||
"source": "https://github.com/ADOdb/ADOdb"
|
"source": "https://github.com/ADOdb/ADOdb"
|
||||||
},
|
},
|
||||||
"time": "2022-04-26T06:46:16+00:00"
|
"time": "2022-11-01T17:36:51+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "egroupware/bookmarks",
|
"name": "egroupware/bookmarks",
|
||||||
@ -12332,5 +12332,5 @@
|
|||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "7.4"
|
"php": "7.4"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.2.0"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user