0
Fork 0
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:
Katharina Irrgang 2017-03-02 17:02:23 +01:00 committed by Hannah Wolfe
parent c70fbc2c7e
commit 0b68458eb7
2 changed files with 3 additions and 17 deletions

View file

@ -1,5 +1,5 @@
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
@ -8,7 +8,7 @@ var config = require('./core/server/config'),
require('./core/server/overrides');
module.exports = {
currentVersion: utils.ghostVersion.safe,
currentVersion: ghostVersion.safe,
database: config.get('database'),
migrationPath: config.get('paths:migrationPath')
};

View file

@ -1,6 +1,5 @@
var path = require('path'),
_ = require('lodash'),
errors = require('../errors');
_ = require('lodash');
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
if (!this.get('privacy')) {
@ -31,19 +30,6 @@ exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) {
exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) {
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) {
if (_.isObject(configValue)) {
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey);