From 7e455e6fceeaaefa28b9c02db92dad01917d2c5a Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 13 Jun 2019 12:03:46 +0200 Subject: [PATCH] drop unnecessary code, restore instead of remove archived files in restoration script, change restore archived name --- ...{restored-archived.js => restore-archived.js} | 16 ++-------------- storage/file.js | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) rename scripts/{restored-archived.js => restore-archived.js} (81%) diff --git a/scripts/restored-archived.js b/scripts/restore-archived.js similarity index 81% rename from scripts/restored-archived.js rename to scripts/restore-archived.js index 4cefc764b..3b516eb2b 100644 --- a/scripts/restored-archived.js +++ b/scripts/restore-archived.js @@ -1,28 +1,16 @@ var nThen = require("nthen"); var Store = require("../storage/file"); -var Pinned = require("./pinned"); var config = require("../lib/load-config"); var store; -var pins; var Log; nThen(function (w) { // load the store which will be used for iterating over channels // and performing operations like archival and deletion Store.create(config, w(function (_) { store = _; - })); // load the list of pinned files so you know which files - // should not be archived or deleted - Pinned.load(w(function (err, _) { - if (err) { - w.abort(); - return void console.error(err); - } - pins = _; - }), { - pinPath: config.pinPath, - }); + })); // load the logging module so that you have a record of which // files were archived or deleted at what time @@ -42,7 +30,7 @@ nThen(function (w) { // but if it's been stored for the configured time... // expire it - store.removeArchivedChannel(item.channel, w(function (err) { + store.restoreArchivedChannel(item.channel, w(function (err) { if (err) { Log.error('RESTORE_ARCHIVED_CHANNEL_RESTORATION_ERROR', { error: err, diff --git a/storage/file.js b/storage/file.js index f92600c46..01d9e5401 100644 --- a/storage/file.js +++ b/storage/file.js @@ -603,7 +603,7 @@ module.exports.create = function ( if (!isValidChannelId(channelName)) { return void cb(new Error('EINVAL')); } archiveChannel(env, channelName, cb); }, - unarchiveChannel: function (channelName, cb) { + restoreArchivedChannel: function (channelName, cb) { if (!isValidChannelId(channelName)) { return void cb(new Error('EINVAL')); } unarchiveChannel(env, channelName, cb); },