Actualiser api/index.php
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
+9
-5
@@ -9008,13 +9008,17 @@ function importMergeBackup(PDO $db): void {
|
||||
$exists->execute($params);
|
||||
$existingId = $exists->fetchColumn();
|
||||
if ($existingId) {
|
||||
// Update label/icon (and keywords if present) from prod, keep local id/is_builtin
|
||||
$updCols = array_diff(array_keys($row), $uniqueCols, ['is_builtin', 'sort_order']);
|
||||
$skipCols = array_merge($uniqueCols, ['is_builtin', 'sort_order']);
|
||||
$updCols = [];
|
||||
$updParams = [];
|
||||
foreach ($row as $col => $val) {
|
||||
if (in_array($col, $skipCols, true)) continue;
|
||||
$updCols[] = "$col = ?";
|
||||
$updParams[] = $val;
|
||||
}
|
||||
if (!empty($updCols)) {
|
||||
$setClause = implode(', ', array_map(fn($c) => "$c = ?", $updCols));
|
||||
$updParams = array_map(fn($c) => $row[$c], $updCols);
|
||||
$updParams[] = $existingId;
|
||||
$db->prepare("UPDATE {$table} SET {$setClause} WHERE id = ?")->execute($updParams);
|
||||
$db->prepare("UPDATE {$table} SET " . implode(', ', $updCols) . " WHERE id = ?")->execute($updParams);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user