Skip to content

Node.js based forum software built for the modern web

resolved #997

Julian Lambbdcd5d46026
diff --git a/nodebb b/nodebb
index 25bb31f1c5..9e313a7f4f 100755
--- a/nodebb
+++ b/nodebb
@@ -6,7 +6,7 @@
case "$1" in
start)
- node app
+ node app "$@"
;;
upgrade)
@@ -26,14 +26,14 @@ case "$1" in
echo "Launching NodeBB in \"development\" mode."
echo "To run the production build of NodeBB, please use \"forever\"."
echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB"
- NODE_ENV=development node app
+ NODE_ENV=development node app "$@"
;;
watch)
echo "Launching NodeBB in \"development\" mode."
echo "To run the production build of NodeBB, please use \"forever\"."
echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB"
- NODE_ENV=development supervisor -q --extensions 'node|js|tpl' -- app $1
+ NODE_ENV=development supervisor -q --extensions 'node|js|tpl' -- app "$@"
;;
# language)
diff --git a/src/plugins.js b/src/plugins.js
index f2346dfc71..d2b7a6cc98 100644
--- a/src/plugins.js
+++ b/src/plugins.js
@@ -4,8 +4,11 @@ var fs = require('fs'),
winston = require('winston'),
nconf = require('nconf'),
eventEmitter = require('events').EventEmitter,
+ semver = require('semver'),
+
db = require('./database'),
- meta = require('./meta');
+ meta = require('./meta'),
+ pkg = require('../package.json');
(function(Plugins) {
@@ -107,6 +110,26 @@ var fs = require('fs'),
var pluginData = JSON.parse(data),
libraryPath, staticDir;
+ if (pluginData.minver && semver.validRange(pluginData.minver)) {
+ if (!semver.satisfies(pkg.version, pluginData.minver)) {
+ // If NodeBB is not new enough to run this plugin
+ if (process.env.NODE_ENV === 'development') {
+ // Throw a warning in development, but do nothing else
+ winston.warn('[plugins/' + pluginData.id + '] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing.');
+ } else {
+ if (nconf.get('check-plugins') !== false) {
+ // Refuse to load this plugin...
+ winston.error('[plugins/' + pluginData.id + '] This plugin is reportedly incompatible with your version of NodeBB, so it has been disabled.');
+ winston.error('[plugins/' + pluginData.id + '] Use `--no-check-plugins` if you wish to live dangerously.');
+
+ // ... and disable it, too
+ Plugins.toggleActive(pluginData.id);
+ return callback();
+ }
+ }
+ }
+ }
+
async.parallel([
function(next) {
if (pluginData.library) {