some prep work to allow for checking of dependency versions. Also updated upgrade.check behaviour to send back error if schema is out of date, instead of no error and "false".

v1.18.x
Julian Lam 10 years ago
parent da1c347fc2
commit 1069f9c936

@ -182,16 +182,13 @@ function start() {
function(next) {
require('./src/meta').configs.init(next);
},
function(next) {
return next(new Error('dependencies-out-of-date'));
},
function(next) {
require('./src/upgrade').check(next);
},
function(schema_ok, next) {
if (!schema_ok && nconf.get('check-schema') !== false) {
winston.warn('Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:');
winston.warn(' ./nodebb upgrade');
process.exit();
return;
}
function(next) {
var webserver = require('./src/webserver');
require('./src/socket.io').init(webserver.server);
@ -204,12 +201,25 @@ function start() {
}
], function(err) {
if (err) {
if (err.stacktrace !== false) {
winston.error(err.stack);
} else {
winston.error(err.message);
switch(err.message) {
case 'schema-out-of-date':
winston.warn('Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:');
winston.warn(' ./nodebb upgrade');
break;
case 'dependencies-out-of-date':
winston.warn('One or more of NodeBB\'s dependent packages are out-of-date. Please run the following command to update them:');
winston.warn(' ./nodebb upgrade');
break;
default:
if (err.stacktrace !== false) {
winston.error(err.stack);
} else {
winston.error(err.message);
}
break;
}
// Either way, bad stuff happened. Abort start.
process.exit();
}
});

@ -34,12 +34,13 @@ Upgrade.check = function(callback) {
if (err) {
return callback(err);
}
callback(null, true);
callback(null);
});
return;
}
callback(null, parseInt(value, 10) >= latestSchema);
var schema_ok = parseInt(value, 10) >= latestSchema;
callback(!schema_ok ? new Error('schema-out-of-date') : null);
});
};

Loading…
Cancel
Save