mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: removed series from upgrade script
This commit is contained in:
@@ -14,39 +14,30 @@ module.exports = {
|
|||||||
const progress = this.progress;
|
const progress = this.progress;
|
||||||
|
|
||||||
batch.processSortedSet('posts:pid', function (pids, next) {
|
batch.processSortedSet('posts:pid', function (pids, next) {
|
||||||
async.eachSeries(pids, function (pid, _next) {
|
progress.incr(pids.length);
|
||||||
progress.incr();
|
let postData;
|
||||||
let postData;
|
async.waterfall([
|
||||||
|
function (next) {
|
||||||
async.waterfall([
|
posts.getPostsFields(pids, ['uid', 'tid', 'upvotes', 'downvotes', 'timestamp'], next);
|
||||||
function (next) {
|
},
|
||||||
posts.getPostFields(pid, ['uid', 'tid', 'upvotes', 'downvotes', 'timestamp'], next);
|
function (_postData, next) {
|
||||||
},
|
postData = _postData;
|
||||||
function (_postData, next) {
|
const tids = postData.map(p => p.tid);
|
||||||
if (!_postData.uid || !_postData.tid) {
|
topics.getTopicsFields(tids, ['cid'], next);
|
||||||
return _next();
|
},
|
||||||
|
function (topicData, next) {
|
||||||
|
const bulk = [];
|
||||||
|
postData.forEach(function (p, index) {
|
||||||
|
if (p && p.uid && p.tid) {
|
||||||
|
bulk.push(['cid:' + topicData[index].cid + ':uid:' + p.uid + ':pids', p.timestamp, p.pid]);
|
||||||
|
if (p.votes > 0) {
|
||||||
|
bulk.push(['cid:' + topicData[index].cid + ':uid:' + p.uid + ':pids:votes', p.votes, p.pid]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
postData = _postData;
|
});
|
||||||
topics.getTopicField(postData.tid, 'cid', next);
|
db.sortedSetAddBulk(bulk, next);
|
||||||
},
|
},
|
||||||
function (cid, next) {
|
], next);
|
||||||
const keys = [
|
|
||||||
'cid:' + cid + ':uid:' + postData.uid + ':pids',
|
|
||||||
];
|
|
||||||
const scores = [
|
|
||||||
postData.timestamp,
|
|
||||||
];
|
|
||||||
if (postData.votes > 0) {
|
|
||||||
keys.push('cid:' + cid + ':uid:' + postData.uid + ':pids:votes');
|
|
||||||
scores.push(postData.votes);
|
|
||||||
}
|
|
||||||
db.sortedSetsAdd(keys, scores, pid, next);
|
|
||||||
},
|
|
||||||
function (next) {
|
|
||||||
db.sortedSetRemove('uid:' + postData.uid + ':posts:votes', pid, next);
|
|
||||||
},
|
|
||||||
], _next);
|
|
||||||
}, next);
|
|
||||||
}, {
|
}, {
|
||||||
progress: progress,
|
progress: progress,
|
||||||
}, callback);
|
}, callback);
|
||||||
|
|||||||
Reference in New Issue
Block a user