bug: BackupTable deletes archive file before confirming DB row deletion #76

Closed
opened 2026-06-21 23:01:24 +00:00 by jmiller · 0 comments
Owner

Severity: HIGH

BackupTable::delete() calls @unlink($this->absolute_path) before parent::delete($pk). If the DB delete fails, the archive file is permanently lost but the record still shows filesexist = 1.

Fix

Reverse the order — delete DB row first, then file:

$path = $this->absolute_path;
$result = parent::delete($pk);
if ($result && !empty($path) && is_file($path)) {
    @unlink($path);
}
return $result;

File

  • src/Table/BackupTable.php:42-47
## Severity: HIGH `BackupTable::delete()` calls `@unlink($this->absolute_path)` before `parent::delete($pk)`. If the DB delete fails, the archive file is permanently lost but the record still shows `filesexist = 1`. ## Fix Reverse the order — delete DB row first, then file: ```php $path = $this->absolute_path; $result = parent::delete($pk); if ($result && !empty($path) && is_file($path)) { @unlink($path); } return $result; ``` ## File - `src/Table/BackupTable.php:42-47`
jmiller added the component: engine label 2026-06-21 23:01:24 +00:00
Sign in to join this conversation.
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteBackup#76