|
|
@ -212,22 +212,32 @@ function upgrade() {
|
|
|
|
|
|
|
|
|
|
|
|
function activate() {
|
|
|
|
function activate() {
|
|
|
|
var db = require('./src/database');
|
|
|
|
var db = require('./src/database');
|
|
|
|
db.init(function (err) {
|
|
|
|
var plugins = require('./src/plugins');
|
|
|
|
if (err) {
|
|
|
|
var plugin = nconf.get('activate');
|
|
|
|
winston.error(err.stack);
|
|
|
|
async.waterfall([
|
|
|
|
process.exit(1);
|
|
|
|
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');
|
|
|
|
winston.info('Activating plugin `%s`', plugin);
|
|
|
|
if (plugin.indexOf('nodebb-') !== 0) {
|
|
|
|
db.sortedSetAdd('plugins:active', 0, plugin, next);
|
|
|
|
// Allow omission of `nodebb-plugin-`
|
|
|
|
},
|
|
|
|
plugin = 'nodebb-plugin-' + plugin;
|
|
|
|
], function (err) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
winston.error(err.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
process.exit(err ? 1 : 0);
|
|
|
|
winston.info('Activating plugin `%s`', plugin);
|
|
|
|
|
|
|
|
db.sortedSetAdd('plugins:active', 0, plugin, function (err) {
|
|
|
|
|
|
|
|
process.exit(err ? 1 : 0);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|