Skip to content

Node.js based forum software built for the modern web

110% -> upgrade.js converts existing motd's to html widgets for extra bonus points.

psychobunnyba657aec4e80
diff --git a/src/upgrade.js b/src/upgrade.js
index 8ebab4f102..2d6f2545d0 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, 14, 21, 50).getTime();
+ var latestSchema = new Date(2014, 1, 19, 18, 15).getTime();
db.get('schemaDate', function(err, value) {
if (parseInt(value, 10) >= latestSchema) {
@@ -685,6 +685,38 @@ Upgrade.upgrade = function(callback) {
winston.info('[2014/2/14] Added posts to sorted set - skipped');
next();
}
+ },
+ function(next) {
+ thisSchemaDate = new Date(2014, 1, 19, 18, 15).getTime();
+
+ if (schemaDate < thisSchemaDate) {
+ updatesMade = true;
+
+ if (Meta.config['motd']) {
+ db.setObjectField('widgets:home.tpl', 'motd', JSON.stringify([
+ {
+ "widget": "html",
+ "data": {
+ "html": Meta.config['motd']
+ }
+ }
+ ]), function(err) {
+ Meta.configs.remove('motd');
+ Meta.configs.remove('motd_class');
+ Meta.configs.remove('show_motd');
+
+ winston.info('[2014/2/19] Updated MOTD to use the HTML widget.');
+ next(err);
+ });
+ } else {
+ winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped');
+ next();
+ }
+
+ } else {
+ winston.info('[2014/2/19] Updating MOTD to use the HTML widget - skipped');
+ next();
+ }
}
// Add new schema updates here
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!