Skip to content

Commit

Permalink
Dont change existing container settings if the container is removed a…
Browse files Browse the repository at this point in the history
…nd re-added
  • Loading branch information
austinwbest committed Sep 18, 2024
1 parent 469888f commit a001392
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions root/app/www/public/crons/state.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,24 @@
foreach ($currentContainers as $currentContainer) {
if (!in_array($currentContainer, $previousContainers)) {
$containerHash = md5($currentContainer);
$updates = $settingsTable['updates'] ?: 3; //-- CHECK ONLY FALLBACK
$frequency = $settingsTable['updatesFrequency'] ?: DEFAULT_CRON; //-- DAILY FALLBACK
$added[] = ['container' => $currentContainer];
$exists = apiRequest('database-getContainerFromHash', ['hash' => $containerHash]);

apiRequest('database-addContainer', [], ['hash' => $containerHash, 'updates' => $updates, 'frequency' => $frequency]);
if (!$exists) {
$updates = $settingsTable['updates'] ?: 3; //-- CHECK ONLY FALLBACK
$frequency = $settingsTable['updatesFrequency'] ?: DEFAULT_CRON; //-- DAILY FALLBACK

apiRequest('database-addContainer', [], ['hash' => $containerHash, 'updates' => $updates, 'frequency' => $frequency]);
}

$added[] = ['container' => $currentContainer];
}
}

if ($added && apiRequest('database-isNotificationTriggerEnabled', ['trigger' => 'added'])['result']) {
$notify['state']['added'] = $added;
logger(CRON_STATE_LOG, 'Added containers: ' . json_encode($added, JSON_UNESCAPED_SLASHES));
}

logger(CRON_STATE_LOG, 'Added containers: ' . json_encode($added, JSON_UNESCAPED_SLASHES));

//-- CHECK FOR REMOVED CONTAINERS
Expand Down

0 comments on commit a001392

Please sign in to comment.