Resources database backup system
More and more things depend on KAMD's resources database. Recent documents, favourites, KRunner, to name a few.
Now, SQLite is fairly stable with the write-ahead-log that has been enabled in KAMD for ages, but corruptions can still happen. Sometimes in SQLite, sometimes in the underlying file system.
This patch introduces a two-step backup system for the
resources database. On each start, the current database
files are copied to test-backup
directory.
If no error appeared during the previous KAMD run, the
test-backup
files are promoted to working-backup
.
This means that in order for a specific version of the database to be considered as 'working' (promoted to a working backup), it needs to have been a beginning of an error-free KAMD session.