mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
🎨 optimise requires for MigratorConfig (#8088)
no issue - if knex-migrator loads the MigratorConfig too much stuff was required, which increases the memory usage - i have deleted the IncorrectUsage errors for now, because this error should actually never appear
This commit is contained in:
parent
c70fbc2c7e
commit
0b68458eb7
2 changed files with 3 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
||||||
var config = require('./core/server/config'),
|
var config = require('./core/server/config'),
|
||||||
utils = require('./core/server/utils');
|
ghostVersion = require('./core/server/utils/ghost-version');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* knex-migrator can be used via CLI or within the application
|
* knex-migrator can be used via CLI or within the application
|
||||||
|
@ -8,7 +8,7 @@ var config = require('./core/server/config'),
|
||||||
require('./core/server/overrides');
|
require('./core/server/overrides');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
currentVersion: utils.ghostVersion.safe,
|
currentVersion: ghostVersion.safe,
|
||||||
database: config.get('database'),
|
database: config.get('database'),
|
||||||
migrationPath: config.get('paths:migrationPath')
|
migrationPath: config.get('paths:migrationPath')
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
var path = require('path'),
|
var path = require('path'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash');
|
||||||
errors = require('../errors');
|
|
||||||
|
|
||||||
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
||||||
if (!this.get('privacy')) {
|
if (!this.get('privacy')) {
|
||||||
|
@ -31,19 +30,6 @@ exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
|
||||||
exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) {
|
exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!obj) {
|
|
||||||
throw new errors.IncorrectUsageError({
|
|
||||||
message: 'makePathsAbsolute: Can\'t make paths absolute of non existing object.',
|
|
||||||
help: parent
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!parent) {
|
|
||||||
throw new errors.IncorrectUsageError({
|
|
||||||
message: 'makePathsAbsolute: Parent is missing.'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_.each(obj, function (configValue, pathsKey) {
|
_.each(obj, function (configValue, pathsKey) {
|
||||||
if (_.isObject(configValue)) {
|
if (_.isObject(configValue)) {
|
||||||
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey);
|
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey);
|
||||||
|
|
Loading…
Reference in a new issue