Skip to content

[bug]: Backup Append Backup Name as a directory to the Storage path restore issue. #1054

Description

@jfinstrom

FreePBX Version

FreePBX 16/17

Issue Description

When a backup job writes to a Filestore location with Append Backup Name as a directory to the Storage path = Yes, the backup file is correctly created under:

<storage path>/<backup_name>/<backup-file>

However, that backup does not appear in the Backup & Restore restore UI under the local/cloud cache unless the Filestore path is changed to point directly at the generated <backup_name> subdirectory.

Steps to reproduce

  1. In Filestore, create a local storage location pointing to a mounted USB path such as:
    • /mnt/backup
  2. In Backup & Restore, create or edit a backup job.
  3. Select the Filestore location above as a storage target.
  4. Set Append Backup Name as a directory to the Storage path to Yes.
  5. Run the backup.
  6. Confirm from CLI that the backup exists in:
    • /mnt/backup/<backup_name>/
    • and also in /var/spool/asterisk/backup/<backup_name>/
  7. Open the restore UI and check the available files in local/cloud cache.

Actual behavior

The backup stored in the Filestore location under /mnt/backup/<backup_name>/ is not shown in restore cache browsing.

Expected behavior

If backup storage intentionally writes to:

<storage path>/<backup_name>/<backup-file>

then restore/cache discovery should also find and display those backups when browsing that Filestore location.

Workaround

If the Filestore path is changed to the full generated subdirectory, for example:

/mnt/backup/<backup_name>

then the backups become visible in restore browsing.

Another workaround is to disable Append Backup Name as a directory to the Storage path so files are written directly under the configured storage path.

Notes

The write-side behavior appears intentional in Handlers/Storage.php:

if (isset($this->backupInfo['backup_addbjname']) && $this->backupInfo['backup_addbjname'] == 'yes') {
	if ($info['driver'] == 'Email') {
		$Rfile = basename((string) $this->file);
	} else { 
		$Rfile = $this->backupInfo['backup_name'].'/'.basename((string) $this->file);
		$this->freepbx->Filestore->makeDirectory($id, $this->backupInfo['backup_name']);
	}
}

This suggests the bug is likely on the restore/cache discovery side, where Filestore-backed browsing may not be recursing into the generated backup-name subdirectory even though the storage writer places files there by design.

Operating Environment

  • Module: FreePBX/backup Latest 17
  • Related module: FreePBX/filestore
  • Filestore type: Local path on mounted USB drive
  • Example storage path: /mnt/backup

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageTriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions