Remove old cache files when backup settings is changed
This commit is contained in:
@@ -22,6 +22,7 @@ exports = module.exports = {
|
||||
download: download,
|
||||
|
||||
cleanup: cleanup,
|
||||
cleanupCacheFilesSync: cleanupCacheFilesSync,
|
||||
|
||||
// for testing
|
||||
_getBackupFilePath: getBackupFilePath,
|
||||
@@ -865,6 +866,15 @@ function cleanupBoxBackups(backupConfig, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupCacheFilesSync() {
|
||||
var files = safe.fs.readdirSync(path.join(paths.BACKUP_INFO_DIR));
|
||||
if (!files) return;
|
||||
|
||||
files.filter(function (f) { return f.endsWith('.sync.cache'); }).forEach(function (f) {
|
||||
safe.fs.unlinkSync(path.join(paths.BACKUP_INFO_DIR, f));
|
||||
});
|
||||
}
|
||||
|
||||
// removes the snapshots of apps that have been uninstalled
|
||||
function cleanupSnapshots(backupConfig, callback) {
|
||||
assert.strictEqual(typeof backupConfig, 'object');
|
||||
|
||||
Reference in New Issue
Block a user