Skip to content

Commit 8c77e54

Browse files
committed
Keep previous host certificates in remove_orphaned cron (fixes phpipam#41)
Certificates referenced by hosts.c_id_old are the host's certificate history and are no longer treated as orphaned. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RuhB6rpLgBrF8dpAsSimX9
1 parent 8487e78 commit 8c77e54

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎functions/cron/remove_orphaned.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#
3131
try {
3232
# remove
33-
$certificates = $Database->runQuery("delete FROM certificates WHERE `t_id` = ? and is_manual = 0 and id NOT IN (SELECT c_id from hosts where c_id is not NULL)", [$tenant_id]);
33+
$certificates = $Database->runQuery("delete FROM certificates WHERE `t_id` = ? and is_manual = 0 and id NOT IN (SELECT c_id from hosts where c_id is not NULL) and id NOT IN (SELECT c_id_old from hosts where c_id_old is not NULL)", [$tenant_id]);
3434
} catch (Exception $e) {
3535
// print error
3636
$Common->errors[] = $e->getMessage();

0 commit comments

Comments
 (0)