1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Delete old journals when moving the database

This commit is contained in:
Joe Steele 2014-03-01 12:40:01 -05:00
parent 0f991b434e
commit 8d0901a178

View File

@ -331,14 +331,17 @@ public class LockableDatabase {
}
final StorageManager storageManager = getStorageManager();
File oldDatabase = storageManager.getDatabase(uUid, oldProviderId);
// create new path
prepareStorage(newProviderId);
// move all database files
Utility.moveRecursive(storageManager.getDatabase(uUid, oldProviderId), storageManager.getDatabase(uUid, newProviderId));
Utility.moveRecursive(oldDatabase, storageManager.getDatabase(uUid, newProviderId));
// move all attachment files
Utility.moveRecursive(storageManager.getAttachmentDirectory(uUid, oldProviderId), storageManager.getAttachmentDirectory(uUid, newProviderId));
// remove any remaining old journal files
deleteDatabase(oldDatabase);
mStorageProviderId = newProviderId;