- Introduced support for a new `all` tag to display all snapshots regardless of specific tags.
- Added functionality to dynamically fetch and display all available tags in the repository, improving usability and flexibility.
- Enhanced error handling for empty repositories or inaccessible snapshots with detailed log messages.
- **Improved Snapshot Display**:
- For the `all` tag, all snapshots are displayed in a formatted output including `short_id`, `time`, and associated tags.
- Enhanced the script to log raw snapshot data during errors for easier debugging.
### Fixed
- Resolved issues with fetching available tags when no snapshots existed in the repository, ensuring consistent script behavior.
- Fixed a missing password issue when executing `restic -r /mnt/backups snapshots --json`, ensuring `RESTIC_PASSWORD` is securely passed in all cases.
- Corrected formatting and display of available tags to ensure no duplicate or unnecessary entries are shown.
### Updated
- **Logging and Usability**:
- Improved log formatting to include more descriptive timestamps and detailed error or success messages for each step.
- Standardized output for snapshot retrieval by tag, including snapshot ID, timestamp, and tags in a clean and readable format.
- **Environment Validation**:
- Updated `view_snapshots.sh` to ensure all necessary environment variables (`RESTIC_REPOSITORY`, `RESTIC_PASSWORD`) are set before executing Restic commands.
- Validated repository access and password file existence at the start of the script to avoid runtime errors.
### Improved
- **Modularity and Robustness**:
- Refactored `view_snapshots.sh` to handle dynamic tags more effectively, making it easier to extend or customize in the future.
- Centralized dependency validation (`restic`, `jq`) and repository checks to reduce redundancy across script operations.
- **Error Handling**:
- Added detailed error messages when repository access fails or tags cannot be fetched, ensuring issues are easy to debug.
- Ensured graceful script exits with appropriate logs when critical validation checks fail.
- **Code Maintenance**:
- Reduced redundancy by consolidating snapshot and tag-related logic into reusable functions.
- Enhanced maintainability by improving script readability, modularity, and inline documentation.
- Improved restoration script to handle specific backup types (core files, media files, database backups) based on tags.
- Integrated functionality to restore databases directly by piping `.sql` files from Restic to MySQL.
- Added automatic detection of database credentials from `wp-config.php` with fallback to default values for `DB_HOST`.
- Ensured proper environment setup with `RESTIC_PASSWORD` retrieved securely from `/etc/restic-password`.
- **Automatic Backup Tagging**:
- Modified `backup_all.sh` to differentiate between manual (`manual-backup-YYYY-MM-DD_HH-MM-SS`) and automated (`auto-backup-YYYY-MM-DD_HH-MM-SS`) backups.
- Ensured backups triggered by cron jobs are tagged appropriately for easy identification.
- **`manage_backup_schedule.sh` Enhancements**:
- Ensured `backup_all.sh` runs in `auto` mode when added to cron, guaranteeing automated backups have the correct tags.
- Validated cron job syntax and dependencies to avoid misconfigurations.
- Added explicit logging of cron actions, including schedule additions, updates, removals, and listing.
- **Improved Error Messaging**:
- Enhanced restoration script to provide detailed error messages when database restoration fails, including incorrect credentials or insufficient privileges.
### Fixed
- Resolved issues with incorrect handling of database restoration paths, ensuring `.sql` files are restored directly into MySQL when detected.
- Addressed potential confusion in tagging by clearly segregating manual and automated backups in logs and tags.
- Corrected empty `DB_HOST` values in the restoration script by setting a default to `localhost` when no value is provided in `wp-config.php`.
### Updated
- **Logging and Traceability**:
- Enhanced all relevant scripts (`restore_backup_direct.sh`, `backup_all.sh`, `manage_backup_schedule.sh`) to log detailed timestamps and descriptive messages.
- Improved consistency in log formatting across scripts for better traceability.
- Added detailed logs for all cron operations in `manage_backup_schedule.sh` to track automated backups effectively.
### Improved
- **Backup and Restore Modularity**:
- Streamlined the orchestration of backups and restores to ensure modularity and easier debugging.
- Improved robustness of `restore_backup_direct.sh` by handling different backup types dynamically using snapshot tags.
- Simplified management of cron schedules with better error handling and validation in `manage_backup_schedule.sh`.
- **Error Handling**:
- Ensured all scripts exit gracefully on errors with detailed logs to pinpoint issues.
- Enhanced dependency validation to check for all required tools (`restic`, `mysql`, `jq`, `crontab`, etc.) before execution.
- **Code Maintenance**:
- Centralized key operations such as password retrieval, lock handling, and backup tagging across scripts for easier maintenance and fewer redundancies.