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

@ -212,22 +212,32 @@ function upgrade() {
function activate() { function activate() {
var db = require('./src/database'); var db = require('./src/database');
db.init(function (err) { var plugins = require('./src/plugins');
if (err) { var plugin = nconf.get('activate');
winston.error(err.stack); async.waterfall([
process.exit(1); 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;
}
var plugin = nconf.get('activate'); winston.info('Activating plugin `%s`', plugin);
if (plugin.indexOf('nodebb-') !== 0) { db.sortedSetAdd('plugins:active', 0, plugin, next);
// Allow omission of `nodebb-plugin-` },
plugin = 'nodebb-plugin-' + plugin; ], function (err) {
if (err) {
winston.error(err.message);
} }
process.exit(err ? 1 : 0);
winston.info('Activating plugin `%s`', plugin);
db.sortedSetAdd('plugins:active', 0, plugin, function (err) {
process.exit(err ? 1 : 0);
});
}); });
} }

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

Loading…
Cancel
Save