v1.18.x
Julian Lam 11 years ago
parent 695891ffd7
commit bbdcd5d460

@ -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)

@ -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) {

Loading…
Cancel
Save