mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-11 01:52:55 +01:00
feat: cli command for maintenance mode closes #12293
This commit is contained in:
@@ -238,6 +238,12 @@ program
|
|||||||
.action(() => {
|
.action(() => {
|
||||||
require('./manage').info();
|
require('./manage').info();
|
||||||
});
|
});
|
||||||
|
program
|
||||||
|
.command('maintenance <toggle>')
|
||||||
|
.description('Toggle maintenance mode true/false')
|
||||||
|
.action((toggle) => {
|
||||||
|
require('./manage').maintenance(toggle);
|
||||||
|
});
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
const resetCommand = program.command('reset');
|
const resetCommand = program.command('reset');
|
||||||
|
|||||||
@@ -191,6 +191,14 @@ async function info() {
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function maintenance(toggle) {
|
||||||
|
const turnOnMaintenance = toggle === 'true';
|
||||||
|
await db.init();
|
||||||
|
await db.setObjectField('config', 'maintenanceMode', turnOnMaintenance ? 1 : 0);
|
||||||
|
console.log(`Maintenance mode turned ${turnOnMaintenance ? 'on' : 'off'}`);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
async function buildWrapper(targets, options) {
|
async function buildWrapper(targets, options) {
|
||||||
try {
|
try {
|
||||||
await build.build(targets, options);
|
await build.build(targets, options);
|
||||||
@@ -207,3 +215,4 @@ exports.activate = activate;
|
|||||||
exports.listPlugins = listPlugins;
|
exports.listPlugins = listPlugins;
|
||||||
exports.listEvents = listEvents;
|
exports.listEvents = listEvents;
|
||||||
exports.info = info;
|
exports.info = info;
|
||||||
|
exports.maintenance = maintenance;
|
||||||
Reference in New Issue
Block a user