Skip to content

Node.js based forum software built for the modern web

closes #5607

barisusakli27a76fcfc9b5
diff --git a/app.js b/app.js
index 5a6a782c57..754822ff42 100644
--- a/app.js
+++ b/app.js
@@ -212,22 +212,32 @@ 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;
+ }
- var plugin = nconf.get('activate');
- 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, next);
+ },
+ ], function (err) {
+ if (err) {
+ winston.error(err.message);
}
-
- winston.info('Activating plugin `%s`', plugin);
- db.sortedSetAdd('plugins:active', 0, plugin, function (err) {
- process.exit(err ? 1 : 0);
- });
+ process.exit(err ? 1 : 0);
});
}
diff --git a/nodebb b/nodebb
index 803ccd2100..447f17c9a6 100755
--- a/nodebb
+++ b/nodebb
@@ -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);
},