Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
clear: function() {
var query;
if (config.limit)
query = Post.find().order('-modif').offset(config.limit);
else
query = Post.find({
'upload': orm.lt(new Date(new Date() - (6000 * config.timeout)))
});
query.run(function(err, posts) {
var del = function(dir, file) {
fs.exists(dir + '/' + file, function(e) {
if (e) fs.unlink(dir + '/' + file, erresp);
});
};
var processcom = function(err, com) {
for (var i in com.thread) {
del((config.upload || './img'), com.thread[i].img);
del('./thumb', com.thread[i].img);
}
};
for (var i in posts) {
if (err) return;