Skip to content

Keep captured and picked media out of device backups - #14

Merged
simonhamp merged 1 commit into
mainfrom
fix/exclude-captures-from-backup
Oct 22, 2026
Merged

simonhamp merged 1 commit into
mainfrom
fix/exclude-captures-from-backup

Conversation

@simonhamp

Copy link
Copy Markdown
Member

Follow-up to #12. Moving captures out of cache/temp made them persistent, which also put them in device backups.

Android: files went to filesDir/Camera and filesDir/Gallery. A stock NativePHP app has allowBackup="true" with empty backup rules, so those were uploaded to Google Drive by Auto Backup. They now go to noBackupFilesDir/Camera and noBackupFilesDir/Gallery. That folder is app-private, not purged by the OS, and never backed up.

iOS: the photo and video paths already set isExcludedFromBackup, but copyFileToCache (gallery picks) didn't, so picked files were backed up to iCloud. It now sets the flag on the final file.

Docs: the Storage Locations sections in the README and Boost guidelines still listed {cache} and Photos//Videos/ folders the code doesn't use. They now show the real paths and say that the plugin never deletes these files, so apps should copy what they need and unlink() the original.

#12 isn't in a release yet, so no shipped installs have files in the backed-up folders.

Please test on a real Android device: take a photo and check file_exists($path) in PHP. Issue #8 said PHP couldn't read cacheDir. I think the file was actually purged before PHP read it, since PHP runs in-process with no open_basedir, and no_backup sits next to files/ and cache/. If PHP really is limited to files/, this change would break PHP access again. Nothing here has been built or run on a device yet.

🤖 Generated with Claude Code

Since #12, captures and gallery picks live in persistent app storage
instead of cache/temp. On Android that was filesDir, which Auto Backup
copies to Google Drive in a stock NativePHP app. On iOS the gallery copy
path never set isExcludedFromBackup, so picked files went to iCloud.

Android now writes to noBackupFilesDir, which is persistent and never
backed up. iOS sets isExcludedFromBackup on gallery files like the photo
and video paths already do.

The storage docs were stale, so they now list the real folders and tell
apps to copy what they need and delete the original, since the plugin
never cleans these up.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@simonhamp
simonhamp merged commit 8a7d215 into main Oct 22, 2026
2 checks passed
@simonhamp
simonhamp deleted the fix/exclude-captures-from-backup branch October 22, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant