Fixed bin scripts.

This commit is contained in:
SamTV12345 2024-08-08 21:23:10 +02:00
parent 3ccc3e1324
commit 88862f0246
11 changed files with 22 additions and 6 deletions

View file

@ -25,4 +25,5 @@ if (process.argv.length !== 2) throw new Error('Use: node bin/checkAllPads.js');
console.log(`Pad ${padId}: OK`);
}));
console.log('Finished.');
process.exit(0)
})();

View file

@ -14,6 +14,7 @@ import path from "node:path";
import querystring from "node:querystring";
import axios from 'axios'
import process from "node:process";
process.on('unhandledRejection', (err) => { throw err; });
@ -53,4 +54,5 @@ const settings = require('ep_etherpad-lite/node/utils/Settings');
if (res.data.code === 1) throw new Error(`Error creating session: ${JSON.stringify(res.data)}`);
console.log('Session made: ====> create a cookie named sessionID and set the value to',
res.data.data.sessionID);
process.exit(0)
})();

View file

@ -49,4 +49,5 @@ const settings = require('ep_etherpad-lite/tests/container/loadSettings').loadSe
}
}
console.log(`Deleted ${deleteCount} sessions`);
process.exit(0)
})();

View file

@ -38,4 +38,5 @@ const apikey = fs.readFileSync(filePath, {encoding: 'utf-8'});
const deleteAttempt = await axios.post(uri);
if (deleteAttempt.data.code === 1) throw new Error(`Error deleting pad ${deleteAttempt.data}`);
console.log('Deleted pad', deleteAttempt.data);
process.exit(0)
})();

View file

@ -60,4 +60,5 @@ const padId = process.argv[2];
}
console.log('finished');
process.exit(0)
})();

View file

@ -6,7 +6,8 @@ import util from "node:util";
const fs = require('fs');
import log4js from 'log4js';
import readline from 'readline';
import ueberDB from "ueberdb2";
import {Database} from "ueberdb2";
import process from "node:process";
const settings = require('ep_etherpad-lite/node/utils/Settings');
process.on('unhandledRejection', (err) => { throw err; });
@ -56,7 +57,7 @@ const unescape = (val: string) => {
writeInterval: 100,
json: false, // data is already json encoded
};
const db = new ueberDB.Database( // eslint-disable-line new-cap
const db = new Database( // eslint-disable-line new-cap
settings.dbType,
settings.dbSettings,
dbWrapperSettings,
@ -96,6 +97,8 @@ const unescape = (val: string) => {
'depended on dbms this may take some time..\n');
const closeDB = util.promisify(db.close.bind(db));
// @ts-ignore
await closeDB(null);
log(`finished, imported ${keyNo} keys.`);
process.exit(0)
})();

View file

@ -1,7 +1,7 @@
'use strict';
import process from 'node:process';
import ueberDB from "ueberdb2";
import {Database} from "ueberdb2";
import log4js from 'log4js';
import util from 'util';
const settings = require('ep_etherpad-lite/node/utils/Settings');
@ -23,7 +23,7 @@ process.on('unhandledRejection', (err) => { throw err; });
cache: '0', // The cache slows things down when you're mostly writing.
writeInterval: 0, // Write directly to the database, don't buffer
};
const db = new ueberDB.Database( // eslint-disable-line new-cap
const db = new Database( // eslint-disable-line new-cap
settings.dbType,
settings.dbSettings,
dbWrapperSettings,
@ -31,7 +31,7 @@ process.on('unhandledRejection', (err) => { throw err; });
await db.init();
console.log('Waiting for dirtyDB to parse its file.');
const dirty = await new ueberDB.Database('dirty',`${__dirname}/../var/dirty.db`);
const dirty = new Database('dirty', `${__dirname}/../var/dirty.db`);
await dirty.init();
const keys = await dirty.findKeys('*', '')
@ -57,4 +57,5 @@ process.on('unhandledRejection', (err) => { throw err; });
await db.close(null);
await dirty.close(null);
console.log('Finished.');
process.exit(0)
})();

View file

@ -474,6 +474,6 @@ log4js.configure({
logger.info('No changes.');
}
}
logger.info('Finished');
process.exit(0)
})();

View file

@ -3,6 +3,7 @@
// Returns a list of stale plugins and their authors email
import axios from 'axios'
import process from "node:process";
const currentTime = new Date();
(async () => {
@ -19,4 +20,5 @@ const currentTime = new Date();
console.log(`${name}, ${res.data[plugin].data.maintainers[0].email}`);
}
}
process.exit(0)
})();

View file

@ -7,6 +7,8 @@
// 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.
import process from "node:process";
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 4 && process.argv.length !== 5) {
@ -82,4 +84,5 @@ const newPadId = process.argv[4] || `${padId}-rebuilt`;
await db.shutdown();
console.info('finished');
process.exit(0)
})();

View file

@ -57,4 +57,5 @@ let valueCount = 0;
}
console.info(`Finished: Replaced ${valueCount} values in the database`);
process.exit(0)
})();