mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-03 06:22:18 +02:00
Cleanup dryrun shm and wal files if they exist (#1121)
* Cleanup dryrun shm and wal files if they exist
This commit is contained in:
parent
cf4ee5017f
commit
b365ec6322
23
src/main.d
23
src/main.d
|
@ -380,12 +380,23 @@ int main(string[] args)
|
||||||
// dry-run notification and database setup
|
// dry-run notification and database setup
|
||||||
if (cfg.getValueBool("dry_run")) {
|
if (cfg.getValueBool("dry_run")) {
|
||||||
log.log("DRY-RUN Configured. Output below shows what 'would' have occurred.");
|
log.log("DRY-RUN Configured. Output below shows what 'would' have occurred.");
|
||||||
|
string dryRunShmFile = cfg.databaseFilePathDryRun ~ "-shm";
|
||||||
|
string dryRunWalFile = cfg.databaseFilePathDryRun ~ "-wal";
|
||||||
// If the dry run database exists, clean this up
|
// If the dry run database exists, clean this up
|
||||||
if (exists(cfg.databaseFilePathDryRun)) {
|
if (exists(cfg.databaseFilePathDryRun)) {
|
||||||
// remove the existing file
|
// remove the existing file
|
||||||
log.vdebug("Removing items-dryrun.sqlite3 as it still exists for some reason");
|
log.vdebug("Removing items-dryrun.sqlite3 as it still exists for some reason");
|
||||||
safeRemove(cfg.databaseFilePathDryRun);
|
safeRemove(cfg.databaseFilePathDryRun);
|
||||||
}
|
}
|
||||||
|
// silent cleanup of shm and wal files if they exist
|
||||||
|
if (exists(dryRunShmFile)) {
|
||||||
|
// remove items-dryrun.sqlite3-shm
|
||||||
|
safeRemove(dryRunShmFile);
|
||||||
|
}
|
||||||
|
if (exists(dryRunWalFile)) {
|
||||||
|
// remove items-dryrun.sqlite3-wal
|
||||||
|
safeRemove(dryRunWalFile);
|
||||||
|
}
|
||||||
|
|
||||||
// Make a copy of the original items.sqlite3 for use as the dry run copy if it exists
|
// Make a copy of the original items.sqlite3 for use as the dry run copy if it exists
|
||||||
if (exists(cfg.databaseFilePath)) {
|
if (exists(cfg.databaseFilePath)) {
|
||||||
|
@ -1124,11 +1135,23 @@ int main(string[] args)
|
||||||
|
|
||||||
// --dry-run temp database cleanup
|
// --dry-run temp database cleanup
|
||||||
if (cfg.getValueBool("dry_run")) {
|
if (cfg.getValueBool("dry_run")) {
|
||||||
|
string dryRunShmFile = cfg.databaseFilePathDryRun ~ "-shm";
|
||||||
|
string dryRunWalFile = cfg.databaseFilePathDryRun ~ "-wal";
|
||||||
if (exists(cfg.databaseFilePathDryRun)) {
|
if (exists(cfg.databaseFilePathDryRun)) {
|
||||||
// remove the file
|
// remove the file
|
||||||
log.vdebug("Removing items-dryrun.sqlite3 as dry run operations complete");
|
log.vdebug("Removing items-dryrun.sqlite3 as dry run operations complete");
|
||||||
|
// remove items-dryrun.sqlite3
|
||||||
safeRemove(cfg.databaseFilePathDryRun);
|
safeRemove(cfg.databaseFilePathDryRun);
|
||||||
}
|
}
|
||||||
|
// silent cleanup of shm and wal files if they exist
|
||||||
|
if (exists(dryRunShmFile)) {
|
||||||
|
// remove items-dryrun.sqlite3-shm
|
||||||
|
safeRemove(dryRunShmFile);
|
||||||
|
}
|
||||||
|
if (exists(dryRunWalFile)) {
|
||||||
|
// remove items-dryrun.sqlite3-wal
|
||||||
|
safeRemove(dryRunWalFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit application
|
// Exit application
|
||||||
|
|
Loading…
Reference in a new issue