This commit is contained in:
2026-02-04 01:53:35 +01:00
parent 24b7f3383a
commit 5b359b0a16
2 changed files with 17 additions and 1 deletions

View File

@@ -4349,6 +4349,18 @@ class ApiKernel
$allowed = ['bridge_url', 'bridge_token', 'sender_token', 'external_api_token', 'editor_default', 'bridge_tables', 'bridge_setup', 'versions_retention'];
$fields = array_intersect_key($data, array_flip($allowed));
if (!$fields) return $this->getCustomerSettings($customerId);
if (array_key_exists('versions_retention', $fields)) {
try {
$columns = $this->tableColumns($this->customerSettingsTable());
if (!in_array('versions_retention', $columns, true)) {
$sql = 'ALTER TABLE `' . $this->customerSettingsTable() . '` ADD COLUMN `versions_retention` int(10) unsigned DEFAULT 0';
$this->pdo->exec($sql);
}
} catch (Throwable $e) {
// Falls die Spalte nicht angelegt werden kann, Einstellung ignorieren.
unset($fields['versions_retention']);
}
}
if (array_key_exists('bridge_tables', $fields)) {
$normalized = $this->normalizeBridgeTables($fields['bridge_tables']);
$fields['bridge_tables'] = $normalized ? $this->encodeBridgeTables($normalized) : null;
@@ -4693,6 +4705,7 @@ CREATE TABLE IF NOT EXISTS `$table` (
`external_api_token` varchar(255) DEFAULT NULL,
`editor_default` varchar(32) DEFAULT NULL,
`bridge_tables` text DEFAULT NULL,
`versions_retention` int(10) unsigned DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`customer_id`)
@@ -4733,6 +4746,9 @@ SQL;
if (!in_array('editor_default', $columns, true)) {
$missing[] = 'ADD COLUMN `editor_default` varchar(32) DEFAULT NULL';
}
if (!in_array('versions_retention', $columns, true)) {
$missing[] = 'ADD COLUMN `versions_retention` int(10) unsigned DEFAULT 0';
}
if (!$missing) {
return;