etherpad-lite/bin/deletePad.js

42 lines
874 B
JavaScript
Raw Normal View History

2013-02-26 12:44:22 +01:00
/*
* A tool for deleting pads from the CLI, because sometimes a brick is required
* to fix a window.
*/
2013-02-26 12:44:22 +01:00
if (process.argv.length != 3) {
2013-02-26 12:44:22 +01:00
console.error("Use: node deletePad.js $PADID");
process.exit(1);
}
// get the padID
let padId = process.argv[2];
let npm = require('../src/node_modules/npm');
npm.load({}, async function(er) {
if (er) {
console.error("Could not load NPM: " + er)
process.exit(1);
2013-02-26 12:44:22 +01:00
}
try {
let settings = require('../src/node/utils/Settings');
let db = require('../src/node/db/DB');
await db.init();
padManager = require('../src/node/db/PadManager');
await padManager.removePad(padId);
console.log("Finished deleting padId: " + padId);
process.exit(0);
} catch (e) {
if (err.name === "apierror") {
console.error(e);
} else {
console.trace(e);
}
process.exit(1);
2013-02-26 12:44:22 +01:00
}
});