mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 23:48:28 +01:00
* Backup/Addressbook: adding limited index-length to backed up schema and fix restore of old backups without (default to 32 on multicolumn indexes including text columns)
This commit is contained in:
parent
5e66d1a2ce
commit
18d74430ea
@ -114,7 +114,8 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4];
|
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4].
|
||||||
|
(is_numeric($row[7]) ? '('.(int)$row[7].')' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort columns by order in the index
|
// sort columns by order in the index
|
||||||
|
@ -226,17 +226,22 @@ class schema_proc
|
|||||||
if (isset($mFields['options'][$this->sType]))
|
if (isset($mFields['options'][$this->sType]))
|
||||||
{
|
{
|
||||||
$options = $mFields['options'][$this->sType]; // db-specific options, eg. index-type
|
$options = $mFields['options'][$this->sType]; // db-specific options, eg. index-type
|
||||||
|
|
||||||
if (!$options) continue; // no index for our db-type
|
if (!$options) continue; // no index for our db-type
|
||||||
}
|
}
|
||||||
unset($mFields['options']);
|
unset($mFields['options']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
foreach((array)$mFields as $k => $col)
|
||||||
{
|
{
|
||||||
// only create indexes on text-columns, if (db-)specifiy options are given or FULLTEXT for mysql
|
// only create indexes on text-columns, if (db-)specifiy options are given or FULLTEXT for mysql
|
||||||
// most DB's cant do them and give errors
|
// most DB's cant do them and give errors
|
||||||
if (in_array($aTableDef['fd'][$mFields]['type'],array('text','longtext')))
|
if (in_array($aTableDef['fd'][$col]['type'],array('text','longtext')))
|
||||||
|
{
|
||||||
|
if (is_array($mFields)) // index over multiple columns including a text column
|
||||||
|
{
|
||||||
|
$mFields[$k] .= '(32)'; // 32=limit of egw_addressbook_extra.extra_value to fix old backups
|
||||||
|
}
|
||||||
|
elseif (!$options) // index over a single text column and no options given
|
||||||
{
|
{
|
||||||
if ($this->sType == 'mysql')
|
if ($this->sType == 'mysql')
|
||||||
{
|
{
|
||||||
@ -244,7 +249,8 @@ class schema_proc
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
continue; // ignore that index
|
continue 2; // ignore that index, 2=not just column but whole index!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user