Prevents moving a directory into its own subdirectory, which would cause
rsync --backup-dir to create nested structures and fail to delete source.
Example prevented: /mnt/disk1/parent → /mnt/disk1/parent/subfolder
The check uses trailing slashes to ensure exact directory boundary matching
and prevent false positives (e.g., /parent vs /parent2).
- Renamed $move variable to $delete_empty_dirs for clearer intent
- Variable now only set to true for rsync copy-delete (not for rsync-rename)
- rsync-rename doesn't need cleanup since source is atomically moved
- Added commented code to prevent moving directory into its own subdirectory
Initialize text array as indexed array to prevent associative array
when only progress line is parsed. Ensures text[0] is always set,
avoiding JSON output like {"1":"..."} in WebGUI.
Multiple improvements to file_manager reliability and status handling:
1. Fix rsync output parsing bug
- rsync returns filename and progress lines in unpredictable order
- Old JS parsing: text[1].split() assumed fixed line order
- New approach: Simplified shell parsing (tail + tr) in PHP
- parse_rsync_progress() helper function for consistent handling
2. Migrate status updates to JSON format
- Structure: {action: int, text: [file_text, progress_text?]}
- PHP: mb_strimhalf() for UTF-8-safe middle truncation
- PHP: htmlspecialchars() escaping, JS adds icons client-side
- Minimizes WebSocket overhead (no HTML in payload)
- Universal handler in BrowseButton.page (6 lines)
3. Fix stale status messages (Nchan caching issue)
- rc.nginx: nchan_message_timeout 30s for /pub/filemanager
- Status expires automatically after 30s
- Prevents displaying outdated progress status in footer
4. Remove obsolete move operation variants (case 5/10)
- file_manager: Remove case 5/10 comments (mv-based move)
- Browse.page: Remove action++ logic from doAction/doActions
- BrowseButton.page: Remove case 5/10 from dfm_makeDialog()
- All moves now use case 4/9 with automatic rsync-rename optimization
- Initialize outside the main loop to ensure correct state handling for move/cleanup phases
- If file_manager restarts and PID is loaded from file and move operation is still active, enable to cleanup empty directories afterwards
- Clarify comment for INI job parameters
Replace complex INI serialization with simple separate .pid file:
- Avoids escaping issues (semicolons, hashes, newlines, etc.)
- No risk of INI file corruption
- Consistent with existing pattern (.active, .status, .error, .pid)
- Simpler code with fewer error sources
- Atomic writes (single number to file)