updated upgrade script so that it does not rely on Groups.list, as the method has changed between v0.5.0 and v0.6.0.

Also added setImmediate call so eachLimit doesn't explode
This commit is contained in:
Julian Lam
2015-02-19 19:33:33 -05:00
parent 756d03fa62
commit 88aa427669

View File

@@ -250,11 +250,24 @@ Upgrade.upgrade = function(callback) {
}, next);
}
Groups.list({showSystemGroups: true}, function(err, groups) {
async.waterfall([
async.apply(db.getSetMembers, 'groups'),
function(groups, next) {
async.filter(groups, function(group, next) {
db.getObjectField('group:' + group, 'hidden', function(err, hidden) {
next(!parseInt(hidden, 10));
}, next);
}, function(groups) {
next(null, groups);
});
}
], function(err, groups) {
if (err) {
return next(err);
}
groups.push('administrators', 'registered-users');
async.eachLimit(cids, 50, function(cid, next) {
upgradePrivileges(cid, groups, next);
}, next);
@@ -445,7 +458,7 @@ Upgrade.upgrade = function(callback) {
if (setting.dailyDigestFreq !== 'off') {
db.sortedSetAdd('digest:' + setting.dailyDigestFreq + ':uids', now, setting.uid, next);
} else {
next(false);
setImmediate(next);
}
}, function(err) {
if (err) {