mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
lint: Run eslint --fix
on bin/
and tests/
This commit is contained in:
parent
0625739cb8
commit
b8d07a42eb
78 changed files with 4319 additions and 4599 deletions
|
@ -2,47 +2,47 @@
|
|||
* This is a repair tool. It extracts all datas of a pad, removes and inserts them again.
|
||||
*/
|
||||
|
||||
console.warn("WARNING: This script must not be used while etherpad is running!");
|
||||
console.warn('WARNING: This script must not be used while etherpad is running!');
|
||||
|
||||
if (process.argv.length != 3) {
|
||||
console.error("Use: node bin/repairPad.js $PADID");
|
||||
console.error('Use: node bin/repairPad.js $PADID');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// get the padID
|
||||
var padId = process.argv[2];
|
||||
const padId = process.argv[2];
|
||||
|
||||
let npm = require("../src/node_modules/npm");
|
||||
npm.load({}, async function(er) {
|
||||
const npm = require('../src/node_modules/npm');
|
||||
npm.load({}, async (er) => {
|
||||
if (er) {
|
||||
console.error("Could not load NPM: " + er)
|
||||
console.error(`Could not load NPM: ${er}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// intialize database
|
||||
let settings = require('../src/node/utils/Settings');
|
||||
let db = require('../src/node/db/DB');
|
||||
const settings = require('../src/node/utils/Settings');
|
||||
const db = require('../src/node/db/DB');
|
||||
await db.init();
|
||||
|
||||
// get the pad
|
||||
let padManager = require('../src/node/db/PadManager');
|
||||
let pad = await padManager.getPad(padId);
|
||||
const padManager = require('../src/node/db/PadManager');
|
||||
const pad = await padManager.getPad(padId);
|
||||
|
||||
// accumulate the required keys
|
||||
let neededDBValues = ["pad:" + padId];
|
||||
const neededDBValues = [`pad:${padId}`];
|
||||
|
||||
// add all authors
|
||||
neededDBValues.push(...pad.getAllAuthors().map(author => "globalAuthor:"));
|
||||
neededDBValues.push(...pad.getAllAuthors().map((author) => 'globalAuthor:'));
|
||||
|
||||
// add all revisions
|
||||
for (let rev = 0; rev <= pad.head; ++rev) {
|
||||
neededDBValues.push("pad:" + padId + ":revs:" + rev);
|
||||
neededDBValues.push(`pad:${padId}:revs:${rev}`);
|
||||
}
|
||||
|
||||
// add all chat values
|
||||
for (let chat = 0; chat <= pad.chatHead; ++chat) {
|
||||
neededDBValues.push("pad:" + padId + ":chat:" + chat);
|
||||
neededDBValues.push(`pad:${padId}:chat:${chat}`);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -55,21 +55,20 @@ npm.load({}, async function(er) {
|
|||
//
|
||||
// See gitlab issue #3545
|
||||
//
|
||||
console.info("aborting [gitlab #3545]");
|
||||
console.info('aborting [gitlab #3545]');
|
||||
process.exit(1);
|
||||
|
||||
// now fetch and reinsert every key
|
||||
neededDBValues.forEach(function(key, value) {
|
||||
console.log("Key: " + key+ ", value: " + value);
|
||||
neededDBValues.forEach((key, value) => {
|
||||
console.log(`Key: ${key}, value: ${value}`);
|
||||
db.remove(key);
|
||||
db.set(key, value);
|
||||
});
|
||||
|
||||
console.info("finished");
|
||||
console.info('finished');
|
||||
process.exit(0);
|
||||
|
||||
} catch (er) {
|
||||
if (er.name === "apierror") {
|
||||
if (er.name === 'apierror') {
|
||||
console.error(er);
|
||||
} else {
|
||||
console.trace(er);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue