Skip to content

Node.js based forum software built for the modern web

#2508

barisusakli6b20cf5cff9a
diff --git a/app.js b/app.js
index 1db84c307a..3efdf2c8e5 100644
--- a/app.js
+++ b/app.js
@@ -150,8 +150,6 @@ function start() {
plugins = require('./src/plugins'),
upgrade = require('./src/upgrade');
- meta.themes.setupPaths();
-
templates.setGlobal('relative_path', nconf.get('relative_path'));
upgrade.check(function(schema_ok) {
@@ -159,12 +157,13 @@ function start() {
webserver.init();
sockets.init(webserver.server);
- if (nconf.get('isPrimary')) {
+ if (nconf.get('isPrimary') === 'true') {
require('./src/notifications').init();
require('./src/user').startJobs();
}
async.waterfall([
+ async.apply(meta.themes.setupPaths),
async.apply(plugins.ready),
async.apply(meta.templates.compile),
async.apply(webserver.listen)
diff --git a/src/meta/themes.js b/src/meta/themes.js
index e3dcb67d01..77f1e41523 100644
--- a/src/meta/themes.js
+++ b/src/meta/themes.js
@@ -108,7 +108,7 @@ module.exports = function(Meta) {
}
};
- Meta.themes.setupPaths = function() {
+ Meta.themes.setupPaths = function(callback) {
async.parallel({
themesData: Meta.themes.get,
currentThemeId: function(next) {
@@ -116,7 +116,7 @@ module.exports = function(Meta) {
}
}, function(err, data) {
if (err) {
- return winston.error(err.stack);
+ return callback(err);
}
var themeId = data.currentThemeId || 'nodebb-theme-vanilla';
@@ -125,12 +125,16 @@ module.exports = function(Meta) {
return themeObj.id === themeId;
})[0];
-
if (process.env.NODE_ENV === 'development') {
winston.info('[themes] Using theme ' + themeId);
}
+ if (!themeObj) {
+ return callback(new Error('[[error:theme-not-found]]'));
+ }
+
Meta.themes.setPath(themeObj);
+ callback();
});
};