more mongo work

v1.18.x
Baris Usakli 11 years ago
parent 1f52717f1e
commit 91d6f83de4

@ -89,14 +89,15 @@
webserver = require('./src/webserver'), webserver = require('./src/webserver'),
SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'], 'browser client minification': true}), SocketIO = require('socket.io').listen(global.server, { log: false, transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'], 'browser client minification': true}),
websockets = require('./src/websockets'), websockets = require('./src/websockets'),
plugins = require('./src/plugins'), // Don't remove this - plugins initializes itself plugins = require('./src/plugins'),
notifications = require('./src/notifications'), notifications = require('./src/notifications'),
upgrade = require('./src/upgrade'); upgrade = require('./src/upgrade');
upgrade.check(function(schema_ok) { upgrade.check(function(schema_ok) {
if (schema_ok || nconf.get('check-schema') === false) { if (schema_ok || nconf.get('check-schema') === false) {
websockets.init(SocketIO); websockets.init(SocketIO);
console.log('calling plugins init');
plugins.init();
global.templates = {}; global.templates = {};
global.translator = translator; global.translator = translator;

@ -15,11 +15,13 @@
"dependencies": { "dependencies": {
"socket.io": "~0.9.16", "socket.io": "~0.9.16",
"redis": "0.8.3", "redis": "0.8.3",
"mongodb": "1.3.20",
"express": "3.2.0", "express": "3.2.0",
"express-namespace": "~0.1.1", "express-namespace": "~0.1.1",
"emailjs": "0.3.4", "emailjs": "0.3.4",
"cookie": "0.0.6", "cookie": "0.0.6",
"connect-redis": "1.4.5", "connect-redis": "1.4.5",
"connect-mongo": "0.4.0",
"passport": "0.1.17", "passport": "0.1.17",
"passport-local": "0.1.6", "passport-local": "0.1.6",
"passport-twitter": "0.1.5", "passport-twitter": "0.1.5",

@ -2,74 +2,212 @@
(function(module) { (function(module) {
'use strict'; 'use strict';
var mongodb = require('mongodb') var Db = require('mongodb').Db,
mongoClient = mongodb.MongoClient, mongoClient = require('mongodb').MongoClient,
Server = require('mongodb').Server,
winston = require('winston'), winston = require('winston'),
nconf = require('nconf'), nconf = require('nconf'),
express = require('express'), express = require('express'),
mongoStore = require('connect-mongo')(express); mongoStore = require('connect-mongo')(express),
mongoHost = nconf.get('mongo:host'); mongoHost = nconf.get('mongo:host'),
db;
// mongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) { var db = new Db(nconf.get('mongo:database'), new Server(mongoHost, nconf.get('mongo:port')), {w:1});
mongoClient.connect('mongodb://' + mongoHost + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, db) { //console.log(db.collection);
db.open(function(err, _db) {
//mongoClient.connect('mongodb://'+ mongoHost + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
console.log('WE ARE CONNECTED');
if(err) { if(err) {
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + error.message); winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
process.exit(); process.exit();
} }
// TODO: fill out settings.db
module.sessionStore = new mongoStore({
db: db
});
db.collection('objects').findOne({_key:'config'}, {timeout:true}, function(err, item) {
console.log('fail');
console.log(item);
callback(err, item);
});
});
db.createCollection('objects', function(err, collection) {
console.log('collection created', err, collection);
});
db.createCollection('sets', function(err, collection) {
}); });
// look up how its done in mongo // look up how its done in mongo
/*if (nconf.get('mongo:password')) { /*if (nconf.get('mongo:password')) {
redisClient.auth(nconf.get('mongo:password')); redisClient.auth(nconf.get('mongo:password'));
} }
*/ */
// TODO: fill out settings.db
module.sessionStore = new mongoStore({
db: settings.db
});
// //
// Exported functions // Exported functions
// //
module.getFileName = function(callback) { module.getFileName = function(callback) {
// TODO : get mongodb filename throw new Error('not-implemented');
}
module.info = function(callback) {
throw new Error('not-implemented');
}
// key
module.exists = function(key, callback) {
throw new Error('not-implemented');
}
module.delete = function(key, callback) {
throw new Error('not-implemented');
}
module.get = function(key, callback) {
throw new Error('not-implemented');
}
module.set = function(key, callback) {
throw new Error('not-implemented');
} }
//hashes
module.setObject = function(key, data, callback) { module.setObject = function(key, data, callback) {
// TODO : implement in mongo data['_key'] = key;
db.collection('objects').insert(data, {w:1}, function(err, result) {
callback(err, result);
});
} }
module.setObjectField = function(key, field, callback) { module.setObjectField = function(key, field, value, callback) {
// TODO : implement in mongo db.collection('objects').update();
} }
module.getObject = function(key, callback) { module.getObject = function(key, callback) {
// TODO : implement in mongo console.log('calling findOne');
db.collection('objects').findOne({_key:key}, {timeout:true},function(err, item) {
console.log(item);
callback(err, item);
});
} }
module.getObjectField = function(key, field, callback) { module.getObjectField = function(key, field, callback) {
// TODO : implement in mongo throw new Error('not-implemented');
} }
module.getObjectFields = function(key, fields, callback) { module.getObjectFields = function(key, fields, callback) {
// TODO : implement in mongo throw new Error('not-implemented');
}
module.getObjectValues = function(key, callback) {
throw new Error('not-implemented');
}
module.isObjectField = function(key, field, callback) {
throw new Error('not-implemented');
} }
module.deleteObjectField = function(key, field, callback) { module.deleteObjectField = function(key, field, callback) {
// TODO : implement in mongo throw new Error('not-implemented');
}
module.incrObjectField = function(key, field, callback) {
throw new Error('not-implemented');
}
module.decrObjectField = function(key, field, callback) {
throw new Error('not-implemented');
} }
module.incrObjectField = function(key, field, value, callback) { module.incrObjectFieldBy = function(key, field, value, callback) {
// TODO : implement in mongo throw new Error('not-implemented');
} }
// sets
module.setAdd = function(key, value, callback) {
throw new Error('not-implemented');
}
module.setRemove = function(key, value, callback) {
throw new Error('not-implemented');
}
module.isSetMember = function(key, value, callback) {
throw new Error('not-implemented');
}
module.isMemberOfSets = function(sets, value, callback) {
throw new Error('not-implemented');
}
module.getSetMembers = function(key, callback) {
console.log('getting set members');
db.collection('sets').findOne({_key:key}, function(err, data) {
console.log('derp', err, data);
callback(err, data);
});
}
module.setCount = function(key, callback) {
throw new Error('not-implemented');
}
module.setRemoveRandom = function(key, callback) {
throw new Error('not-implemented');
}
// sorted sets
module.sortedSetAdd = function(key, score, value, callback) {
throw new Error('not-implemented');
}
module.sortedSetRemove = function(key, value, callback) {
throw new Error('not-implemented');
}
module.getSortedSetRange = function(key, start, stop, callback) {
throw new Error('not-implemented');
}
module.getSortedSetRevRange = function(key, start, stop, callback) {
throw new Error('not-implemented');
}
module.getSortedSetRevRangeByScore = function(args, callback) {
throw new Error('not-implemented');
}
module.sortedSetCount = function(key, min, max, callback) {
throw new Error('not-implemented');
}
// lists
module.listPrepend = function(key, value, callback) {
throw new Error('not-implemented');
}
module.listAppend = function(key, value, callback) {
throw new Error('not-implemented');
}
module.getListRange = function(key, start, stop, callback) {
throw new Error('not-implemented');
}
}(exports)); }(exports));

@ -3,325 +3,343 @@ var fs = require('fs'),
async = require('async'), async = require('async'),
winston = require('winston'), winston = require('winston'),
eventEmitter = require('events').EventEmitter, eventEmitter = require('events').EventEmitter,
db = require('./database'), db = require('./database');
plugins = { (function(Plugins) {
libraries: {},
loadedHooks: {},
staticDirs: {},
cssFiles: [],
// Events Plugins.libraries = {};
readyEvent: new eventEmitter, Plugins.loadedHooks = {};
Plugins.staticDirs = {};
Plugins.cssFiles = [];
init: function() { Plugins.initialized = false;
if (this.initialized) return;
if (global.env === 'development') winston.info('[plugins] Initializing plugins system');
this.reload(function(err) { // Events
if (err) { Plugins.readyEvent = new eventEmitter;
if (global.env === 'development') winston.info('[plugins] NodeBB encountered a problem while loading plugins', err.message);
return; Plugins.init = function() {
console.log('plugins init called');
if (Plugins.initialized) {
return;
}
if (global.env === 'development') {
winston.info('[plugins] Initializing plugins system');
}
Plugins.reload(function(err) {
if (err) {
if (global.env === 'development') {
winston.info('[plugins] NodeBB encountered a problem while loading plugins', err.message);
} }
return;
}
if (global.env === 'development') winston.info('[plugins] Plugins OK'); if (global.env === 'development') {
winston.info('[plugins] Plugins OK');
}
Plugins.initialized = true;
plugins.readyEvent.emit('ready');
});
};
Plugins.ready = function(callback) {
if (!Plugins.initialized) {
Plugins.readyEvent.once('ready', callback);
} else {
callback();
}
};
Plugins.reload = function(callback) {
// Resetting all local plugin data
Plugins.loadedHooks = {};
Plugins.staticDirs = {};
Plugins.cssFiles.length = 0;
// Read the list of activated plugins and require their libraries
async.waterfall([
function(next) {
db.getSetMembers('plugins:active', next);
},
function(plugins, next) {
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
async.each(plugins, function(plugin, next) {
var modulePath = path.join(__dirname, '../node_modules/', plugin);
if (fs.existsSync(modulePath)) {
Plugins.loadPlugin(modulePath, next);
} else {
if (global.env === 'development') {
winston.warn('[plugins] Plugin \'' + plugin + '\' not found');
}
next(); // Ignore this plugin silently
}
}, next);
} else next();
},
function(next) {
if (global.env === 'development') winston.info('[plugins] Sorting hooks to fire in priority sequence');
Object.keys(Plugins.loadedHooks).forEach(function(hook) {
var hooks = Plugins.loadedHooks[hook];
hooks = hooks.sort(function(a, b) {
return a.priority - b.priority;
});
});
plugins.initialized = true; next();
plugins.readyEvent.emit('ready'); }
}); ], callback);
}, };
ready: function(callback) {
if (!this.initialized) this.readyEvent.once('ready', callback); Plugins.loadPlugin = function(pluginPath, callback) {
else callback(); fs.readFile(path.join(pluginPath, 'plugin.json'), function(err, data) {
}, if (err) {
initialized: false, return callback(err);
reload: function(callback) { }
var _self = this;
var pluginData = JSON.parse(data),
// Resetting all local plugin data libraryPath, staticDir;
this.loadedHooks = {};
this.staticDirs = {}; async.parallel([
this.cssFiles.length = 0;
// Read the list of activated plugins and require their libraries
async.waterfall([
function(next) { function(next) {
db.getSetMembers('plugins:active', next); if (pluginData.library) {
}, libraryPath = path.join(pluginPath, pluginData.library);
function(plugins, next) {
if (plugins && Array.isArray(plugins) && plugins.length > 0) { fs.exists(libraryPath, function(exists) {
async.each(plugins, function(plugin, next) { if (exists) {
var modulePath = path.join(__dirname, '../node_modules/', plugin); if (!Plugins.libraries[pluginData.id]) {
if (fs.existsSync(modulePath)) _self.loadPlugin(modulePath, next); Plugins.libraries[pluginData.id] = require(libraryPath);
else { }
if (global.env === 'development') winston.warn('[plugins] Plugin \'' + plugin + '\' not found');
next(); // Ignore this plugin silently // Register hooks for this plugin
if (pluginData.hooks && Array.isArray(pluginData.hooks) && pluginData.hooks.length > 0) {
async.each(pluginData.hooks, function(hook, next) {
Plugins.registerHook(pluginData.id, hook, next);
}, next);
} else {
next(null);
}
} else {
winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id);
next();
} }
}, next); });
} else next(); } else {
winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id);
next();
}
}, },
function(next) { function(next) {
if (global.env === 'development') winston.info('[plugins] Sorting hooks to fire in priority sequence'); // Static Directories for Plugins
Object.keys(_self.loadedHooks).forEach(function(hook) { if (pluginData.staticDir) {
var hooks = _self.loadedHooks[hook]; staticDir = path.join(pluginPath, pluginData.staticDir);
hooks = hooks.sort(function(a, b) {
return a.priority - b.priority; fs.exists(staticDir, function(exists) {
if (exists) {
Plugins.staticDirs[pluginData.id] = staticDir;
next();
} else next();
}); });
}); } else next();
},
next(); function(next) {
} // CSS Files for plugins
], callback); if (pluginData.css && pluginData.css instanceof Array) {
}, if (global.env === 'development') {
loadPlugin: function(pluginPath, callback) { winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id);
var _self = this;
fs.readFile(path.join(pluginPath, 'plugin.json'), function(err, data) {
if (err) return callback(err);
var pluginData = JSON.parse(data),
libraryPath, staticDir;
async.parallel([
function(next) {
if (pluginData.library) {
libraryPath = path.join(pluginPath, pluginData.library);
fs.exists(libraryPath, function(exists) {
if (exists) {
if (!_self.libraries[pluginData.id]) {
_self.libraries[pluginData.id] = require(libraryPath);
}
// Register hooks for this plugin
if (pluginData.hooks && Array.isArray(pluginData.hooks) && pluginData.hooks.length > 0) {
async.each(pluginData.hooks, function(hook, next) {
_self.registerHook(pluginData.id, hook, next);
}, next);
} else {
next(null);
}
} else {
winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id);
next();
}
});
} else {
winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id);
next();
} }
},
function(next) {
// Static Directories for Plugins
if (pluginData.staticDir) {
staticDir = path.join(pluginPath, pluginData.staticDir);
fs.exists(staticDir, function(exists) {
if (exists) {
_self.staticDirs[pluginData.id] = staticDir;
next();
} else next();
});
} else next();
},
function(next) {
// CSS Files for plugins
if (pluginData.css && pluginData.css instanceof Array) {
if (global.env === 'development') {
winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id);
}
_self.cssFiles = _self.cssFiles.concat(pluginData.css.map(function(file) { Plugins.cssFiles = Plugins.cssFiles.concat(pluginData.css.map(function(file) {
return path.join('/plugins', pluginData.id, file); return path.join('/plugins', pluginData.id, file);
})); }));
next(); next();
} else next(); } else next();
} }
], function(err) { ], function(err) {
if (!err) { if (!err) {
if (global.env === 'development') winston.info('[plugins] Loaded plugin: ' + pluginData.id); if (global.env === 'development') winston.info('[plugins] Loaded plugin: ' + pluginData.id);
callback(); callback();
} else callback(new Error('Could not load plugin system')) } else callback(new Error('Could not load plugin system'))
});
}); });
}, });
registerHook: function(id, data, callback) { };
/*
`data` is an object consisting of (* is required): Plugins.registerHook = function(id, data, callback) {
`data.hook`*, the name of the NodeBB hook /*
`data.method`*, the method called in that plugin `data` is an object consisting of (* is required):
`data.callbacked`, whether or not the hook expects a callback (true), or a return (false). Only used for filters. (Default: false) `data.hook`*, the name of the NodeBB hook
`data.priority`, the relative priority of the method when it is eventually called (default: 10) `data.method`*, the method called in that plugin
*/ `data.callbacked`, whether or not the hook expects a callback (true), or a return (false). Only used for filters. (Default: false)
var _self = this; `data.priority`, the relative priority of the method when it is eventually called (default: 10)
*/
if (data.hook && data.method) {
data.id = id; if (data.hook && data.method) {
if (!data.priority) data.priority = 10; data.id = id;
data.method = data.method.split('.').reduce(function(memo, prop) { if (!data.priority) data.priority = 10;
if (memo[prop]) { data.method = data.method.split('.').reduce(function(memo, prop) {
return memo[prop]; if (memo[prop]) {
} else { return memo[prop];
// Couldn't find method by path, assuming property with periods in it (evil!) } else {
_self.libraries[data.id][data.method]; // Couldn't find method by path, assuming property with periods in it (evil!)
} Plugins.libraries[data.id][data.method];
}, _self.libraries[data.id]); }
}, Plugins.libraries[data.id]);
_self.loadedHooks[data.hook] = _self.loadedHooks[data.hook] || [];
_self.loadedHooks[data.hook].push(data); Plugins.loadedHooks[data.hook] = Plugins.loadedHooks[data.hook] || [];
Plugins.loadedHooks[data.hook].push(data);
if (global.env === 'development') winston.info('[plugins] Hook registered: ' + data.hook + ' will call ' + id);
callback(); if (global.env === 'development') {
} else return; winston.info('[plugins] Hook registered: ' + data.hook + ' will call ' + id);
}, }
fireHook: function(hook, args, callback) { callback();
var _self = this } else return;
hookList = this.loadedHooks[hook]; };
if (hookList && Array.isArray(hookList)) { Plugins.fireHook = function(hook, args, callback) {
//if (global.env === 'development') winston.info('[plugins] Firing hook: \'' + hook + '\''); hookList = Plugins.loadedHooks[hook];
var hookType = hook.split(':')[0];
switch (hookType) { if (hookList && Array.isArray(hookList)) {
case 'filter': //if (global.env === 'development') winston.info('[plugins] Firing hook: \'' + hook + '\'');
async.reduce(hookList, args, function(value, hookObj, next) { var hookType = hook.split(':')[0];
if (hookObj.method) { switch (hookType) {
if (hookObj.callbacked) { // If a callback is present (asynchronous method) case 'filter':
hookObj.method.call(_self.libraries[hookObj.id], value, next); async.reduce(hookList, args, function(value, hookObj, next) {
} else { // Synchronous method if (hookObj.method) {
value = hookObj.method.call(_self.libraries[hookObj.id], value); if (hookObj.callbacked) { // If a callback is present (asynchronous method)
next(null, value); hookObj.method.call(Plugins.libraries[hookObj.id], value, next);
} } else { // Synchronous method
} else { value = hookObj.method.call(Plugins.libraries[hookObj.id], value);
if (global.env === 'development') winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.');
next(null, value); next(null, value);
} }
}, function(err, value) { } else {
if (err) { if (global.env === 'development') winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.');
if (global.env === 'development') { next(null, value);
winston.info('[plugins] Problem executing hook: ' + hook); }
} }, function(err, value) {
if (err) {
if (global.env === 'development') {
winston.info('[plugins] Problem executing hook: ' + hook);
} }
}
callback.apply(plugins, arguments); callback.apply(plugins, arguments);
}); });
break; break;
case 'action': case 'action':
async.each(hookList, function(hookObj) { async.each(hookList, function(hookObj) {
if (hookObj.method) { if (hookObj.method) {
hookObj.method.call(_self.libraries[hookObj.id], args); hookObj.method.call(Plugins.libraries[hookObj.id], args);
} else { } else {
if (global.env === 'development') { if (global.env === 'development') {
winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.');
}
} }
}); }
break; });
default: break;
// Do nothing... default:
break; // Do nothing...
} break;
} else { }
// Otherwise, this hook contains no methods } else {
var returnVal = args; // Otherwise, this hook contains no methods
if (callback) { var returnVal = args;
callback(null, returnVal); if (callback) {
} callback(null, returnVal);
} }
}, }
isActive: function(id, callback) { };
db.isSetMember('plugins:active', id, callback);
}, Plugins.isActive = function(id, callback) {
toggleActive: function(id, callback) { db.isSetMember('plugins:active', id, callback);
this.isActive(id, function(err, active) { };
Plugins.toggleActive = function(id, callback) {
Plugins.isActive(id, function(err, active) {
if (err) {
if (global.env === 'development') winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\'');
return;
}
db[(active ? 'setRemove' : 'setAdd')]('plugins:active', id, function(err, success) {
if (err) { if (err) {
if (global.env === 'development') winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\''); if (global.env === 'development') winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\'');
return; return;
} }
db[(active ? 'setRemove' : 'setAdd')]('plugins:active', id, function(err, success) { // Reload meta data
if (err) { plugins.reload(function() {
if (global.env === 'development') winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\''); // (De)activation Hooks
return; plugins.fireHook('action:plugin.' + (active ? 'de' : '') + 'activate', id);
}
// Reload meta data if (callback) {
plugins.reload(function() { callback({
// (De)activation Hooks id: id,
plugins.fireHook('action:plugin.' + (active ? 'de' : '') + 'activate', id); active: !active
});
if (callback) { }
callback({
id: id,
active: !active
});
}
});
}); });
}); });
}, });
showInstalled: function(callback) { }
var _self = this;
npmPluginPath = path.join(__dirname, '../node_modules');
async.waterfall([
function(next) {
fs.readdir(npmPluginPath, function(err, dirs) {
dirs = dirs.map(function(file) {
return path.join(npmPluginPath, file);
}).filter(function(file) {
var stats = fs.statSync(file);
if (stats.isDirectory() && file.substr(npmPluginPath.length + 1, 14) === 'nodebb-plugin-') return true;
else return false;
});
next(err, dirs); Plugins.showInstalled = function(callback) {
npmPluginPath = path.join(__dirname, '../node_modules');
async.waterfall([
function(next) {
fs.readdir(npmPluginPath, function(err, dirs) {
dirs = dirs.map(function(file) {
return path.join(npmPluginPath, file);
}).filter(function(file) {
var stats = fs.statSync(file);
if (stats.isDirectory() && file.substr(npmPluginPath.length + 1, 14) === 'nodebb-plugin-') return true;
else return false;
}); });
},
function(files, next) {
var plugins = [];
async.each(files, function(file, next) {
var configPath;
async.waterfall([
function(next) {
fs.readFile(path.join(file, 'plugin.json'), next);
},
function(configJSON, next) {
try {
var config = JSON.parse(configJSON);
} catch (err) {
winston.warn("Plugin: " + file + " is corrupted or invalid. Please check plugin.json for errors.")
return next(err, null);
}
_self.isActive(config.id, function(err, active) {
if (err) next(new Error('no-active-state'));
delete config.library; next(err, dirs);
delete config.hooks; });
config.active = active; },
config.activeText = '<i class="fa fa-power-off"></i> ' + (active ? 'Dea' : 'A') + 'ctivate'; function(files, next) {
next(null, config); var plugins = [];
});
async.each(files, function(file, next) {
var configPath;
async.waterfall([
function(next) {
fs.readFile(path.join(file, 'plugin.json'), next);
},
function(configJSON, next) {
try {
var config = JSON.parse(configJSON);
} catch (err) {
winston.warn("Plugin: " + file + " is corrupted or invalid. Please check plugin.json for errors.")
return next(err, null);
} }
], function(err, config) {
if (err) return next(); // Silently fail
plugins.push(config); Plugins.isActive(config.id, function(err, active) {
next(); if (err) next(new Error('no-active-state'));
});
}, function(err) {
next(null, plugins);
});
}
], function(err, plugins) {
callback(err, plugins);
});
}
}
plugins.init(); delete config.library;
delete config.hooks;
config.active = active;
config.activeText = '<i class="fa fa-power-off"></i> ' + (active ? 'Dea' : 'A') + 'ctivate';
next(null, config);
});
}
], function(err, config) {
if (err) return next(); // Silently fail
module.exports = plugins; plugins.push(config);
next();
});
}, function(err) {
next(null, plugins);
});
}
], function(err, plugins) {
callback(err, plugins);
});
}
}(exports));

@ -103,7 +103,7 @@ var bcrypt = require('bcrypt'),
if (email !== undefined) { if (email !== undefined) {
db.setObjectField('email:uid', email, uid); db.setObjectField('email:uid', email, uid);
//User.sendConfirmationEmail(email); User.sendConfirmationEmail(email);
} }
plugins.fireHook('action:user.create', {uid: uid, username: username, email: email, picture: gravatar, timestamp: timestamp}); plugins.fireHook('action:user.create', {uid: uid, username: username, email: email, picture: gravatar, timestamp: timestamp});

Loading…
Cancel
Save