change style of meta.js

v1.18.x
Barış Soner Uşaklı 8 years ago
parent 769d2b00b1
commit edeb22fcdf

@ -8,71 +8,71 @@ var nconf = require('nconf');
var pubsub = require('./pubsub'); var pubsub = require('./pubsub');
var utils = require('./utils'); var utils = require('./utils');
(function (Meta) { var Meta = module.exports;
Meta.reloadRequired = false;
require('./meta/configs')(Meta); Meta.reloadRequired = false;
require('./meta/themes')(Meta);
require('./meta/js')(Meta);
require('./meta/css')(Meta);
require('./meta/sounds')(Meta);
require('./meta/settings')(Meta);
require('./meta/logs')(Meta);
require('./meta/errors')(Meta);
require('./meta/tags')(Meta);
require('./meta/dependencies')(Meta);
Meta.templates = require('./meta/templates');
Meta.blacklist = require('./meta/blacklist');
Meta.languages = require('./meta/languages');
/* Assorted */ require('./meta/configs')(Meta);
Meta.userOrGroupExists = function (slug, callback) { require('./meta/themes')(Meta);
var user = require('./user'); require('./meta/js')(Meta);
var groups = require('./groups'); require('./meta/css')(Meta);
slug = utils.slugify(slug); require('./meta/sounds')(Meta);
async.parallel([ require('./meta/settings')(Meta);
async.apply(user.existsBySlug, slug), require('./meta/logs')(Meta);
async.apply(groups.existsBySlug, slug), require('./meta/errors')(Meta);
], function (err, results) { require('./meta/tags')(Meta);
callback(err, results ? results.some(function (result) { return result; }) : false); require('./meta/dependencies')(Meta);
}); Meta.templates = require('./meta/templates');
}; Meta.blacklist = require('./meta/blacklist');
Meta.languages = require('./meta/languages');
/** /* Assorted */
* Reload deprecated as of v1.1.2+, remove in v2.x Meta.userOrGroupExists = function (slug, callback) {
*/ var user = require('./user');
Meta.reload = function (callback) { var groups = require('./groups');
restart(); slug = utils.slugify(slug);
callback(); async.parallel([
}; async.apply(user.existsBySlug, slug),
async.apply(groups.existsBySlug, slug),
], function (err, results) {
callback(err, results ? results.some(function (result) { return result; }) : false);
});
};
Meta.restart = function () { /**
pubsub.publish('meta:restart', { hostname: os.hostname() }); * Reload deprecated as of v1.1.2+, remove in v2.x
restart(); */
}; Meta.reload = function (callback) {
restart();
callback();
};
Meta.getSessionTTLSeconds = function () { Meta.restart = function () {
var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0); pubsub.publish('meta:restart', { hostname: os.hostname() });
var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0); restart();
var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days };
return ttl;
};
if (nconf.get('isPrimary') === 'true') { Meta.getSessionTTLSeconds = function () {
pubsub.on('meta:restart', function (data) { var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0);
if (data.hostname !== os.hostname()) { var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0);
restart(); var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days
} return ttl;
}); };
}
function restart() { if (nconf.get('isPrimary') === 'true') {
if (process.send) { pubsub.on('meta:restart', function (data) {
process.send({ if (data.hostname !== os.hostname()) {
action: 'restart', restart();
});
} else {
winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?');
} }
});
}
function restart() {
if (process.send) {
process.send({
action: 'restart',
});
} else {
winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?');
} }
}(exports)); }

Loading…
Cancel
Save