refactor(backups): centralize storage deletion guard

This commit is contained in:
Andras Bacsai
2026-07-19 23:20:46 +02:00
parent 4e03be755d
commit bf72fd5d88
6 changed files with 38 additions and 21 deletions
+7
View File
@@ -96,6 +96,13 @@ class LocalFileVolume extends BaseModel
return $this->morphMany(ScheduledVolumeBackup::class, 'backupable');
}
public function abortIfScheduledBackupsExist(): void
{
if ($this->scheduledBackups()->exists()) {
abort(422, 'Delete this directory backup schedule and its archives before deleting the directory.');
}
}
public function loadStorageOnServer()
{
if ($this->is_host_file) {