mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 05:55:48 +01:00
upgrade.js - categories.numRecentTopics
This commit is contained in:
@@ -86,7 +86,7 @@
|
|||||||
<div class="col-sm-4 col-xs-12">
|
<div class="col-sm-4 col-xs-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="cid-{categories.cid}-numRecentTopics"># of Recent Topics Displayed</label>
|
<label for="cid-{categories.cid}-numRecentTopics"># of Recent Topics Displayed</label>
|
||||||
<input id="cid-{categories.cid}-numRecentTopics" type="text" class="form-control" placeholder="2" data-name="numRecentTopics" value="{categories.show}" />
|
<input id="cid-{categories.cid}-numRecentTopics" type="text" class="form-control" placeholder="2" data-name="numRecentTopics" value="{categories.numRecentTopics}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var db = require('./database'),
|
|||||||
|
|
||||||
Upgrade.check = function(callback) {
|
Upgrade.check = function(callback) {
|
||||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
||||||
var latestSchema = new Date(2014, 0, 3).getTime();
|
var latestSchema = new Date(2014, 0, 4).getTime();
|
||||||
|
|
||||||
db.get('schemaDate', function(err, value) {
|
db.get('schemaDate', function(err, value) {
|
||||||
if (parseInt(value, 10) >= latestSchema) {
|
if (parseInt(value, 10) >= latestSchema) {
|
||||||
@@ -132,6 +132,29 @@ Upgrade.upgrade = function(callback) {
|
|||||||
winston.info('[2014/1/3] categories.class, categories.link fields skipped');
|
winston.info('[2014/1/3] categories.class, categories.link fields skipped');
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
// Custom classes for each category, adding link field for each category
|
||||||
|
thisSchemaDate = new Date(2014, 0, 4).getTime();
|
||||||
|
if (schemaDate < thisSchemaDate) {
|
||||||
|
updatesMade = true;
|
||||||
|
|
||||||
|
db.getListRange('categories:cid', 0, -1, function(err, cids) {
|
||||||
|
if(err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var cid in cids) {
|
||||||
|
db.setObjectField('category:' + cids[cid], 'numRecentTopics', '2');
|
||||||
|
}
|
||||||
|
|
||||||
|
winston.info('[2013/12/31] Added categories.numRecentTopics fields');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
winston.info('[2014/1/3] categories.numRecentTopics fields skipped');
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Add new schema updates here
|
// Add new schema updates here
|
||||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!
|
||||||
|
|||||||
Reference in New Issue
Block a user