Stirling-PDF
Stirling-PDF copied to clipboard
feat(database): add email notifications for backups/imports & backup verification
Description of Changes
What was changed
- Added enterprise configuration for database-related email notifications:
premium.enterpriseFeatures.databaseNotifications.backups.successful|failedpremium.enterpriseFeatures.databaseNotifications.imports.successful|failed- Extended
ApplicationPropertiesandsettings.yml.templateaccordingly.
- Introduced
DatabaseNotificationServiceInterfaceandDatabaseNotificationServiceto centralize and gate notification sending (EE-only, respectsmail.enabled). - Wired notifications into
DatabaseService:- Sends emails on successful/failed backups and imports.
- Added backup verification step:
- Compute SHA‑256 checksum for backup files.
- Validate backup by loading it into an in‑memory H2 instance (
RUNSCRIPT) before using it. - Abort import if verification fails.
- Enhanced
EmailService:- Added
sendSimpleMail(String to, String subject, String body)(async) for lightweight notifications. - Added debug logging for successful sends.
- Added
- Minor refactors and improved logging around backup/export/import flows.
Why the change was made
- Provide admins with timely, configurable notifications about critical database operations (backups/imports).
- Increase reliability by verifying backup integrity before execution, reducing risk from corrupted or incomplete scripts.
- Keep configuration explicit and self-documenting via new keys in
settings.yml.template.
Checklist
General
- [x] I have read the Contribution Guidelines
- [x] I have read the Stirling-PDF Developer Guide (if applicable)
- [ ] I have read the How to add new languages to Stirling-PDF (if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
Documentation
- [ ] I have updated relevant docs on Stirling-PDF's doc repo (if functionality has heavily changed)
- [ ] I have read the section Add New Translation Tags (for new translation tags only)
UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)
Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the Testing Guide for more details.
Interesting idea.. hmmm