mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #3892
This commit is contained in:
23
src/reset.js
23
src/reset.js
@@ -2,6 +2,7 @@
|
||||
|
||||
var winston = require('winston');
|
||||
var nconf = require('nconf');
|
||||
var async = require('async');
|
||||
var db = require('./database');
|
||||
|
||||
var Reset = {};
|
||||
@@ -81,11 +82,29 @@ function resetThemes(callback) {
|
||||
}
|
||||
|
||||
function resetPlugin(pluginId) {
|
||||
db.sortedSetRemove('plugins:active', pluginId, function(err) {
|
||||
var active = false;
|
||||
|
||||
async.waterfall([
|
||||
async.apply(db.isSortedSetMember, 'plugins:active', pluginId),
|
||||
function(isMember, next) {
|
||||
active = isMember;
|
||||
|
||||
if (isMember) {
|
||||
db.sortedSetRemove('plugins:active', pluginId, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
], function(err) {
|
||||
if (err) {
|
||||
winston.error('[reset] Could not disable plugin: %s encountered error %s', pluginId, err.message);
|
||||
} else {
|
||||
winston.info('[reset] Plugin `%s` disabled', pluginId);
|
||||
if (active) {
|
||||
winston.info('[reset] Plugin `%s` disabled', pluginId);
|
||||
} else {
|
||||
winston.warn('[reset] Plugin `%s` was not active on this forum', pluginId);
|
||||
winston.info('[reset] No action taken.');
|
||||
}
|
||||
}
|
||||
|
||||
process.exit();
|
||||
|
||||
Reference in New Issue
Block a user