nodebb --activate plugin-name

v1.18.x
psychobunny 10 years ago
parent 1cda4e8d9b
commit fbc484d3c9

@ -63,9 +63,7 @@ if (nconf.get('config')) {
} }
configExists = fs.existsSync(configFile); configExists = fs.existsSync(configFile);
if (!nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && !nconf.get('reset') && configExists) { if (nconf.get('setup') || nconf.get('install')) {
start();
} else if (nconf.get('setup') || nconf.get('install')) {
setup(); setup();
} else if (!configExists) { } else if (!configExists) {
require('./install/web').install(nconf.get('port')); require('./install/web').install(nconf.get('port'));
@ -73,6 +71,10 @@ if (!nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && !nc
upgrade(); upgrade();
} else if (nconf.get('reset')) { } else if (nconf.get('reset')) {
reset(); reset();
} else if (nconf.get('activate')) {
activate();
} else {
start();
} }
function loadConfig() { function loadConfig() {
@ -280,6 +282,17 @@ function upgrade() {
}); });
} }
function activate() {
loadConfig();
require('./src/database').init(function(err) {
var plugin = nconf.get('activate'),
db = require('./src/database');
db.sortedSetAdd('plugins:active', plugin, 1, start);
});
}
function reset() { function reset() {
loadConfig(); loadConfig();

@ -115,6 +115,16 @@ switch(process.argv[2]) {
}); });
break; break;
case 'activate':
var args = process.argv.slice(0);
args.unshift('--activate');
cproc.fork('app.js', args, {
cwd: __dirname,
silent: false
});
break;
case 'upgrade': case 'upgrade':
async.series([ async.series([
function(next) { function(next) {

Loading…
Cancel
Save