change style of meta.js

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

@ -8,25 +8,26 @@ 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) {
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');
/* Assorted */
Meta.userOrGroupExists = function (slug, callback) {
var user = require('./user');
var groups = require('./groups');
slug = utils.slugify(slug);
@ -36,37 +37,37 @@ var utils = require('./utils');
], function (err, results) {
callback(err, results ? results.some(function (result) { return result; }) : false);
});
};
};
/**
/**
* Reload deprecated as of v1.1.2+, remove in v2.x
*/
Meta.reload = function (callback) {
Meta.reload = function (callback) {
restart();
callback();
};
};
Meta.restart = function () {
Meta.restart = function () {
pubsub.publish('meta:restart', { hostname: os.hostname() });
restart();
};
};
Meta.getSessionTTLSeconds = function () {
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;
};
};
if (nconf.get('isPrimary') === 'true') {
if (nconf.get('isPrimary') === 'true') {
pubsub.on('meta:restart', function (data) {
if (data.hostname !== os.hostname()) {
restart();
}
});
}
}
function restart() {
function restart() {
if (process.send) {
process.send({
action: 'restart',
@ -74,5 +75,4 @@ var utils = require('./utils');
} else {
winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?');
}
}
}(exports));
}

Loading…
Cancel
Save