Skip to content

Node.js based forum software built for the modern web

upgrade.js - add recentreplies, activeusers, and moderator widgets to the sidebar as default

psychobunny0b3fa0c83890
diff --git a/src/upgrade.js b/src/upgrade.js
index 2d6f2545d0..e0dc8e1974 100644
--- a/src/upgrade.js
+++ b/src/upgrade.js
@@ -19,7 +19,7 @@ var db = require('./database'),
Upgrade.check = function(callback) {
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
- var latestSchema = new Date(2014, 1, 19, 18, 15).getTime();
+ var latestSchema = new Date(2014, 1, 20, 15, 30).getTime();
db.get('schemaDate', function(err, value) {
if (parseInt(value, 10) >= latestSchema) {
@@ -717,6 +717,34 @@ Upgrade.upgrade = function(callback) {
winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped');
next();
}
+ },
+ function(next) {
+ thisSchemaDate = new Date(2014, 1, 20, 15, 30).getTime();
+
+ if (schemaDate < thisSchemaDate) {
+ updatesMade = true;
+
+ db.setObjectField('widgets:category.tpl', 'sidebar', JSON.stringify([
+ {
+ "widget": "recentreplies",
+ "data": {}
+ },
+ {
+ "widget": "activeusers",
+ "data": {}
+ },
+ {
+ "widget": "moderators",
+ "data": {}
+ }
+ ]), function(err) {
+ winston.info('[2014/2/20] Updated MOTD to use the HTML widget.');
+ next(err);
+ });
+ } else {
+ winston.info('[2014/2/20] Updating MOTD to use the HTML widget - skipped');
+ next();
+ }
}
// Add new schema updates here
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!