Skip to content

Node.js based forum software built for the modern web

./nodebb plugins for a list of plugins activated

psychobunnyf702717e6162
diff --git a/app.js b/app.js
index 4aa9371e18..35138f6f54 100644
--- a/app.js
+++ b/app.js
@@ -76,6 +76,8 @@ if (nconf.get('setup') || nconf.get('install')) {
require('./src/reset').reset();
} else if (nconf.get('activate')) {
activate();
+} else if (nconf.get('plugins')) {
+ listPlugins();
} else {
start();
}
@@ -286,6 +288,17 @@ function activate() {
});
}
+function listPlugins() {
+ require('./src/database').init(function(err) {
+ var db = require('./src/database');
+
+ db.getSortedSetRange('plugins:active', 0, -1, function(err, plugins) {
+ winston.info('Active plugins: \n\t - ' + plugins.join('\n\t - '));
+ process.exit();
+ });
+ });
+}
+
function shutdown(code) {
winston.info('[app] Shutdown (SIGTERM/SIGINT) Initialised.');
diff --git a/nodebb b/nodebb
index 01aa843a18..575b8551f1 100755
--- a/nodebb
+++ b/nodebb
@@ -23,6 +23,13 @@ var getRunningPid = function(callback) {
});
};
+function fork(args) {
+ cproc.fork('app.js', args, {
+ cwd: __dirname,
+ silent: false
+ });
+}
+
switch(process.argv[2]) {
case 'status':
getRunningPid(function(err, pid) {
@@ -107,22 +114,20 @@ switch(process.argv[2]) {
case 'reset':
var args = process.argv.slice(0);
args.unshift('--reset');
-
- cproc.fork('app.js', args, {
- cwd: __dirname,
- silent: false
- });
+ fork(args);
break;
case 'activate':
var args = process.argv.slice(0);
- args.unshift('--activate');
+ args.unshift('--activate');
+ fork(args);
+ break;
- cproc.fork('app.js', args, {
- cwd: __dirname,
- silent: false
- });
- break;
+ case 'plugins':
+ var args = process.argv.slice(0);
+ args.unshift('--plugins');
+ fork(args);
+ break;
case 'upgrade':
async.series([
@@ -165,9 +170,11 @@ switch(process.argv[2]) {
process.stdout.write('\t' + 'log'.yellow + '\tOpens the logging interface (useful for debugging)\n');
process.stdout.write('\t' + 'setup'.yellow + '\tRuns the NodeBB setup script\n');
process.stdout.write('\t' + 'reset'.yellow + '\tDisables all plugins, restores the default theme.\n');
+ process.stdout.write('\t' + 'activate'.yellow + '\tActivate a plugin on start up.\n');
+ process.stdout.write('\t' + 'plugins'.yellow + '\tList all plugins that have been installed.\n');
process.stdout.write('\t' + 'upgrade'.yellow + '\tRun NodeBB upgrade scripts, ensure packages are up-to-date\n');
process.stdout.write('\t' + 'dev'.yellow + '\tStart NodeBB in interactive development mode\n');
process.stdout.write('\t' + 'watch'.yellow + '\tStart NodeBB in development mode and watch for changes\n');
process.stdout.write('\n'.reset);
break;
-}
+}
\ No newline at end of file