FreePBX Version
FreePBX 17
Issue Description
Summary
Filestore does not appear to return files correctly from nested subdirectories when listing files from a parent local storage path.
Relates to: #1054
This affects Backup & Restore when a backup job uses Append Backup Name as a directory to the Storage path, because backups are written under:
<storage path>/<backup_name>/<backup-file>
but those files are not shown unless the Filestore path is changed to point directly at the generated <backup_name> subdirectory.
Steps to reproduce
- Create a Filestore local path pointing to a mounted path such as:
- Use that Filestore location in Backup & Restore as a storage target.
- Enable Append Backup Name as a directory to the Storage path.
- Run the backup.
- Confirm the backup file exists under:
/mnt/backup/<backup_name>/
- Attempt to browse or enumerate files through Filestore from the parent path
/mnt/backup.
Actual behavior
Files inside the generated subdirectory are not returned/visible as expected from the parent Filestore path.
Expected behavior
If Filestore is asked to list files recursively from a parent path, it should return files contained in nested subdirectories such as:
/mnt/backup/<backup_name>/<backup-file>
Workaround
Point the Filestore path directly at the generated backup subdirectory, for example:
/mnt/backup/<backup_name>
When using that full path, the backup files become visible.
Notes
This appears related to recursive file listing in Filestore.class.php, specifically listAllFiles($subdir = true).
A change like the following appears relevant:
- // previous logic manually expanded directory contents
+ $recursiveResults = $this->ls($instance['id'], $instance['path'], true);
+ // then filter returned results to files
The issue may be that the current implementation does not fully or consistently return nested files when listing from the parent path.
Operating Environment
Relevant log output
FreePBX Version
FreePBX 17
Issue Description
Summary
Filestore does not appear to return files correctly from nested subdirectories when listing files from a parent local storage path.
Relates to: #1054
This affects Backup & Restore when a backup job uses Append Backup Name as a directory to the Storage path, because backups are written under:
<storage path>/<backup_name>/<backup-file>but those files are not shown unless the Filestore path is changed to point directly at the generated
<backup_name>subdirectory.Steps to reproduce
/mnt/backup/mnt/backup/<backup_name>//mnt/backup.Actual behavior
Files inside the generated subdirectory are not returned/visible as expected from the parent Filestore path.
Expected behavior
If Filestore is asked to list files recursively from a parent path, it should return files contained in nested subdirectories such as:
/mnt/backup/<backup_name>/<backup-file>Workaround
Point the Filestore path directly at the generated backup subdirectory, for example:
/mnt/backup/<backup_name>When using that full path, the backup files become visible.
Notes
This appears related to recursive file listing in
Filestore.class.php, specificallylistAllFiles($subdir = true).A change like the following appears relevant:
The issue may be that the current implementation does not fully or consistently return nested files when listing from the parent path.
Operating Environment
Relevant log output