Skip to content

Node.js based forum software built for the modern web

Merge remote-tracking branch 'origin/master'

Barış Soner Uşaklı14888a96cbe2
diff --cc src/upgrade.js
index 05f8bd5fef,8d247c451c..2ef1f3efd7
--- a/src/upgrade.js
+++ b/src/upgrade.js
@@@ -21,7 -21,7 +21,7 @@@ var db = require('./database')
schemaDate, thisSchemaDate,
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
-- latestSchema = Date.UTC(2015, 1, 23);
++ latestSchema = Date.UTC(2015, 1, 24);
Upgrade.check = function(callback) {
db.get('schemaDate', function(err, value) {
@@@ -862,40 -862,21 +862,58 @@@ Upgrade.upgrade = function(callback)
},
function(next) {
thisSchemaDate = Date.UTC(2015, 1, 23);
+ if (schemaDate < thisSchemaDate) {
+ db.setAdd('plugins:active', 'nodebb-rewards-essentials', function(err) {
+ winston.info('[2015/2/23] Activating NodeBB Essential Rewards');
+ Plugins.reload(function() {
+ if (err) {
+ next(err);
+ } else {
+ Upgrade.update(thisSchemaDate, next);
+ }
+ });
+ });
+ } else {
+ winston.info('[2015/2/23] Activating NodeBB Essential Rewards - skipped');
+ next();
+ }
++ },
++ function(next) {
++ thisSchemaDate = Date.UTC(2015, 1, 24);
+ if (schemaDate < thisSchemaDate) {
+ updatesMade = true;
- winston.info('[2015/02/23] Upgrading plugins:active to sorted set');
++ winston.info('[2015/02/24] Upgrading plugins:active to sorted set');
+
+ db.getSetMembers('plugins:active', function(err, activePlugins) {
+ if (err) {
+ return next(err);
+ }
+ if (!Array.isArray(activePlugins) || !activePlugins.length) {
- winston.info('[2015/02/23] Upgrading plugins:active to sorted set done');
++ winston.info('[2015/02/24] Upgrading plugins:active to sorted set done');
+ Upgrade.update(thisSchemaDate, next);
+ }
+
+ db.delete('plugins:active', function(err) {
+ if (err) {
+ return next(err);
+ }
+ var order = -1;
+ async.eachSeries(activePlugins, function(plugin, next) {
+ ++order;
+ db.sortedSetAdd('plugins:active', order, plugin, next);
+ }, function(err) {
+ if (err) {
+ return next(err);
+ }
- winston.info('[2015/02/23] Upgrading plugins:active to sorted set done');
++ winston.info('[2015/02/24] Upgrading plugins:active to sorted set done');
+ Upgrade.update(thisSchemaDate, next);
+ });
+ });
+ });
+ } else {
- winston.info('[2015/02/23] Upgrading plugins:active to sorted set skipped');
++ winston.info('[2015/02/24] Upgrading plugins:active to sorted set skipped');
+ next();
+ }
}
// Add new schema updates here