v1.18.x
barisusakli 8 years ago
parent b33d25b0b8
commit 27a76fcfc9

@ -212,23 +212,33 @@ function upgrade() {
function activate() {
var db = require('./src/database');
db.init(function (err) {
if (err) {
winston.error(err.stack);
process.exit(1);
}
var plugins = require('./src/plugins');
var plugin = nconf.get('activate');
async.waterfall([
function (next) {
db.init(next);
},
function (next) {
plugins.isInstalled(plugin, next);
},
function (isInstalled, next) {
if (!isInstalled) {
return next(new Error('plugin not installed'));
}
if (plugin.indexOf('nodebb-') !== 0) {
// Allow omission of `nodebb-plugin-`
plugin = 'nodebb-plugin-' + plugin;
}
winston.info('Activating plugin `%s`', plugin);
db.sortedSetAdd('plugins:active', 0, plugin, function (err) {
db.sortedSetAdd('plugins:active', 0, plugin, next);
},
], function (err) {
if (err) {
winston.error(err.message);
}
process.exit(err ? 1 : 0);
});
});
}
function listPlugins() {

@ -408,6 +408,10 @@ var commands = {
process.stdout.write(commands.activate.usage + '\n');
process.exit();
}
if (name.startsWith('nodebb-theme')) {
fork(['--reset', '-t', name]);
return;
}
var arr = ['--activate=' + name].concat(process.argv.slice(4));
fork(arr);
},

Loading…
Cancel
Save