mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
This commit is contained in:
@@ -2,27 +2,23 @@
|
||||
|
||||
var async = require('async'),
|
||||
db = require('../database'),
|
||||
batch = require('../batch'),
|
||||
threadTools = require('../threadTools');
|
||||
|
||||
|
||||
module.exports = function(Categories) {
|
||||
|
||||
Categories.purge = function(cid, callback) {
|
||||
|
||||
Categories.getTopicIds(cid, 0, -1, function(err, tids) {
|
||||
batch.processSortedSet('categories:' + cid + ':tid', function(err, tids, next) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
async.eachLimit(tids, 10, function(tid, next) {
|
||||
threadTools.purge(tid, 0, next);
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
purgeCategory(cid, callback);
|
||||
});
|
||||
}, next);
|
||||
}, {alwaysStartAt: 0}, function(err) {
|
||||
purgeCategory(cid, callback);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -32,13 +28,7 @@ module.exports = function(Categories) {
|
||||
db.sortedSetRemove('categories:cid', cid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.delete('categories:' + cid + ':tid', next);
|
||||
},
|
||||
function(next) {
|
||||
db.delete('categories:recent_posts:cid:' + cid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.delete('category:' + cid, next);
|
||||
db.deleteAll(['categories:' + cid + ':tid', 'categories:recent_posts:cid:' + cid, 'category:' + cid], next);
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user