Fix queued backups never building, per-type retention, and cron connection handling

This commit is contained in:
johnnyq
2026-07-31 16:35:39 -04:00
parent ae468d6cee
commit 53f45fa008
5 changed files with 103 additions and 49 deletions

View File

@@ -223,9 +223,9 @@ if (!empty($_SESSION['backup_master_key_reveal'])) {
<small class="text-muted">0 disables age-based deletion.</small>
</div>
<div class="form-group col-md-4">
<label>Keep at most (backups)</label>
<label>Keep at most (per type)</label>
<input type="number" class="form-control" name="config_backup_retention_count" min="1" value="<?= intval($config_backup_retention_count) ?>">
<small class="text-muted">The newest is never deleted.</small>
<small class="text-muted">Counted separately for each type. The newest of each is never deleted.</small>
</div>
</div>

View File

@@ -20,7 +20,16 @@ if (isset($_GET['queue_backup'])) {
if ($backup_id > 0) {
logAudit("Backup", "Queue", ($session_name ?? 'Unknown User') . " queued a " . backupTypeLabel($type));
flashAlert(backupTypeLabel($type) . " queued - it will start within a minute and you will be notified when it is ready.");
// Saying "it will start within a minute" when the master cron switch is off is a lie
// the user only discovers by waiting, so check before promising.
$cron_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_enable_cron FROM settings WHERE company_id = 1"));
if (intval($cron_row['config_enable_cron']) === 0) {
flashAlert(backupTypeLabel($type) . " queued, but cron is switched off in Settings > Notifications, so it will not start until that is enabled.", 'error');
} else {
flashAlert(backupTypeLabel($type) . " queued - it will start within a minute and you will be notified when it is ready.");
}
} else {
flashAlert($error ?? "Could not queue the backup.", 'error');
}