2023-10-20 22:35:26 +08:00
|
|
|
|
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
2022-12-21 22:59:22 +08:00
|
|
|
|
var prompt = require('prompt-confirm');
|
|
|
|
|
const p = new prompt('Are you sure? This will permanently delete all existing data on your instance.');
|
|
|
|
|
|
|
|
|
|
const Fs = require("fs");
|
|
|
|
|
|
|
|
|
|
var config = require("../lib/load-config");
|
|
|
|
|
var Env = require("../lib/env").create(config);
|
|
|
|
|
Env.Log = { error: console.log };
|
|
|
|
|
|
|
|
|
|
var paths = Env.paths;
|
|
|
|
|
p.ask(function (answer) {
|
|
|
|
|
if (!answer) {
|
|
|
|
|
console.log('Abort');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log('Deleting all data...');
|
|
|
|
|
Object.values(paths).forEach(function (path) {
|
|
|
|
|
console.log(`Deleting ${path}`);
|
2022-12-21 23:02:07 +08:00
|
|
|
|
Fs.rmSync(path, { recursive: true, force: true });
|
2022-12-21 22:59:22 +08:00
|
|
|
|
console.log('Deleted');
|
|
|
|
|
});
|
|
|
|
|
console.log('Success');
|
|
|
|
|
});
|