etherpad-lite/src/bin/checkPad.js

21 lines
762 B
JavaScript
Raw Permalink Normal View History

'use strict';
/*
* This is a debug tool. It checks all revisions for data corruption
*/
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 3) throw new Error('Use: node src/bin/checkPad.js $PADID');
const padId = process.argv[2];
2021-01-09 08:44:59 +01:00
(async () => {
2021-02-03 13:08:43 +01:00
const db = require('../node/db/DB');
await db.init();
2021-02-03 13:08:43 +01:00
const padManager = require('../node/db/PadManager');
2021-11-27 09:37:34 +01:00
if (!await padManager.doesPadExists(padId)) throw new Error('Pad does not exist');
const pad = await padManager.getPad(padId);
2021-11-27 09:37:34 +01:00
await pad.check();
console.log('Finished.');
2021-01-09 08:44:59 +01:00
})();