interim commit

v1.18.x
Julian Lam 11 years ago
parent 62c85274a3
commit f6be3eacfc

@ -24,9 +24,6 @@
"forum": '../forum'
}
});
requirejs.onError = function(err) {
console.log(err);
}
</script>
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />

@ -30,6 +30,7 @@ var RDB = require('./redis.js'),
* the new one put in its place.
*/
RDB.incr('notifications:next_nid', function(err, nid) {
RDB.sadd('notifications', nid);
RDB.hmset('notifications:' + nid, {
text: text || '',
path: path || null,
@ -124,6 +125,14 @@ var RDB = require('./redis.js'),
});
} else callback();
});
},
prune: function(cutoff, callback) {
var today = new Date();
if (!cutoff || !(cutoff instanceof Date)) cutoff = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
RDB.smembers('notifications', function(err, nids) {
});
}
}

@ -59,6 +59,27 @@ Upgrade.upgrade = function() {
next();
}
});
},
function(next) {
RDB.exists('notifications', function(err, exists) {
if (!exists) {
RDB.keys('notifications:*', function(err, keys) {
var multi = RDB.multi();
keys = keys.filter(function(key) {
if (key === 'notifications:next_nid') return false;
else return true;
}).map(function(key) {
return key.slice(14);
});
winston.info('[2013/10/23] Adding existing notifications to set');
RDB.sadd('notifications', keys, next);
});
} else {
winston.info('[2013/10/23] Updates to Notifications skipped.');
}
});
}
// Add new schema updates here
], function(err) {

Loading…
Cancel
Save