diff --git a/api/src/Db/Backup.php b/api/src/Db/Backup.php
index 7527e5637e..150b286f42 100644
--- a/api/src/Db/Backup.php
+++ b/api/src/Db/Backup.php
@@ -505,9 +505,10 @@ class Backup
*
* @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 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
*/
- 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;
$table = null;
@@ -560,7 +561,10 @@ class Backup
}
unset($def);
//echo "
$table_name => ".self::write_array($schema,1)."
\n";
- $this->schema_proc->CreateTable($table_name, $schema);
+ if (!$only_egw || preg_match('/^egw_/', $table_name))
+ {
+ $this->schema_proc->CreateTable($table_name, $schema);
+ }
}
continue;
}
@@ -594,7 +598,7 @@ class Backup
}
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);
if ($table == 'egw_async' && in_array('##last-check-run##',$data))
@@ -882,7 +886,7 @@ class Backup
//echo "function backup($f)
"; // !
@set_time_limit(0);
$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'))
{
self::remove_dir_content($dir.'/database_backup/');
diff --git a/api/src/Db/Schema.php b/api/src/Db/Schema.php
index 356ebbdb90..2774319a66 100644
--- a/api/src/Db/Schema.php
+++ b/api/src/Db/Schema.php
@@ -1330,7 +1330,7 @@ class Schema
{
$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;
}
diff --git a/composer.lock b/composer.lock
index 658989bb9b..cfea48ae79 100644
--- a/composer.lock
+++ b/composer.lock
@@ -799,16 +799,16 @@
},
{
"name": "egroupware/adodb-php",
- "version": "5.20.6",
+ "version": "5.20.7",
"source": {
"type": "git",
"url": "https://github.com/EGroupware/ADOdb.git",
- "reference": "c9a0b97038104af27336c2f752dc4216cbccf7bf"
+ "reference": "2bc7b262d9739c2869d53a120822fc6efeb63a44"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/EGroupware/ADOdb/zipball/c9a0b97038104af27336c2f752dc4216cbccf7bf",
- "reference": "c9a0b97038104af27336c2f752dc4216cbccf7bf",
+ "url": "https://api.github.com/repos/EGroupware/ADOdb/zipball/2bc7b262d9739c2869d53a120822fc6efeb63a44",
+ "reference": "2bc7b262d9739c2869d53a120822fc6efeb63a44",
"shasum": ""
},
"require": {
@@ -853,7 +853,7 @@
"issues": "https://github.com/ADOdb/ADOdb/issues",
"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",
@@ -12332,5 +12332,5 @@
"platform-overrides": {
"php": "7.4"
},
- "plugin-api-version": "2.3.0"
+ "plugin-api-version": "2.2.0"
}