plugins.js uses db, added some set methods to redis.js

v1.18.x
Baris Usakli 11 years ago
parent 347d6c2768
commit 636551d2e9

@ -116,6 +116,21 @@
}
module.setAdd = function(key, value, callback) {
redisClient.sadd(key, value, callback);
}
module.setRemove = function(key, value, callback) {
redisClient.srem(key, value, callback);
}
module.isSetMember = function(key, value, callback) {
redisClient.sismember(key, value, callback);
}
module.getSetMembers = function(key, callback) {
redisClient.smembers(key, callback);
}

@ -46,7 +46,7 @@ var fs = require('fs'),
// Read the list of activated plugins and require their libraries
async.waterfall([
function(next) {
RDB.smembers('plugins:active', next);
db.getSetMembers('plugins:active', next);
},
function(plugins, next) {
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
@ -230,7 +230,7 @@ var fs = require('fs'),
}
},
isActive: function(id, callback) {
RDB.sismember('plugins:active', id, callback);
db.isSetMember('plugins:active', id, callback);
},
toggleActive: function(id, callback) {
this.isActive(id, function(err, active) {
@ -239,7 +239,7 @@ var fs = require('fs'),
return;
}
RDB[(active ? 'srem' : 'sadd')]('plugins:active', id, function(err, success) {
db[(active ? 'setRemove' : 'setAdd')]('plugins:active', id, function(err, success) {
if (err) {
if (global.env === 'development') winston.info('[plugins] Could not toggle active state on plugin \'' + id + '\'');
return;

Loading…
Cancel
Save