mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-15 18:54:45 -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
|
@ -5,60 +5,60 @@
|
|||
*/
|
||||
|
||||
if (process.argv.length != 3) {
|
||||
console.error("Use: node extractPadData.js $PADID");
|
||||
console.error('Use: node extractPadData.js $PADID');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// get the padID
|
||||
let padId = process.argv[2];
|
||||
const padId = process.argv[2];
|
||||
|
||||
let npm = require('../src/node_modules/npm');
|
||||
const npm = require('../src/node_modules/npm');
|
||||
|
||||
npm.load({}, async function(er) {
|
||||
npm.load({}, async (er) => {
|
||||
if (er) {
|
||||
console.error("Could not load NPM: " + er)
|
||||
console.error(`Could not load NPM: ${er}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// initialize 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();
|
||||
|
||||
// load extra modules
|
||||
let dirtyDB = require('../src/node_modules/dirty');
|
||||
let padManager = require('../src/node/db/PadManager');
|
||||
let util = require('util');
|
||||
const dirtyDB = require('../src/node_modules/dirty');
|
||||
const padManager = require('../src/node/db/PadManager');
|
||||
const util = require('util');
|
||||
|
||||
// initialize output database
|
||||
let dirty = dirtyDB(padId + '.db');
|
||||
const dirty = dirtyDB(`${padId}.db`);
|
||||
|
||||
// Promise wrapped get and set function
|
||||
let wrapped = db.db.db.wrappedDB;
|
||||
let get = util.promisify(wrapped.get.bind(wrapped));
|
||||
let set = util.promisify(dirty.set.bind(dirty));
|
||||
const wrapped = db.db.db.wrappedDB;
|
||||
const get = util.promisify(wrapped.get.bind(wrapped));
|
||||
const set = util.promisify(dirty.set.bind(dirty));
|
||||
|
||||
// array in which required key values will be accumulated
|
||||
let neededDBValues = ['pad:' + padId];
|
||||
const neededDBValues = [`pad:${padId}`];
|
||||
|
||||
// get the actual pad object
|
||||
let pad = await padManager.getPad(padId);
|
||||
const pad = await padManager.getPad(padId);
|
||||
|
||||
// add all authors
|
||||
neededDBValues.push(...pad.getAllAuthors().map(author => 'globalAuthor:' + author));
|
||||
neededDBValues.push(...pad.getAllAuthors().map((author) => `globalAuthor:${author}`));
|
||||
|
||||
// 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}`);
|
||||
}
|
||||
|
||||
for (let dbkey of neededDBValues) {
|
||||
for (const dbkey of neededDBValues) {
|
||||
let dbvalue = await get(dbkey);
|
||||
if (dbvalue && typeof dbvalue !== 'object') {
|
||||
dbvalue = JSON.parse(dbvalue);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue