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 utils = require('./utils');
(function (Meta) {
Meta.reloadRequired = false;
var Meta = module.exports;
require('./meta/configs')(Meta);
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');
Meta.reloadRequired = false;
/* Assorted */
Meta.userOrGroupExists = function (slug, callback) {
var user = require('./user');
var groups = require('./groups');
slug = utils.slugify(slug);
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);
});
};
require('./meta/configs')(Meta);
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');
/**
* Reload deprecated as of v1.1.2+, remove in v2.x
*/
Meta.reload = function (callback) {
restart();
callback();
};
/* Assorted */
Meta.userOrGroupExists = function (slug, callback) {
var user = require('./user');
var groups = require('./groups');
slug = utils.slugify(slug);
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() });
restart();
};
/**
* Reload deprecated as of v1.1.2+, remove in v2.x
*/
Meta.reload = function (callback) {
restart();
callback();
};
Meta.getSessionTTLSeconds = function () {
var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0);
var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0);
var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days
return ttl;
};
Meta.restart = function () {
pubsub.publish('meta:restart', { hostname: os.hostname() });
restart();
};
if (nconf.get('isPrimary') === 'true') {
pubsub.on('meta:restart', function (data) {
if (data.hostname !== os.hostname()) {
restart();
}
});
}
Meta.getSessionTTLSeconds = function () {
var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0);
var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0);
var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days
return ttl;
};
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`?');
if (nconf.get('isPrimary') === 'true') {
pubsub.on('meta:restart', function (data) {
if (data.hostname !== os.hostname()) {
restart();
}
});
}
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