mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
fix: refresh settings cache for migration 006 (#7147)
no issue - refresh settings cache after 006/001 migration fixture
This commit is contained in:
parent
e76d35df7d
commit
c6f1a8de13
3 changed files with 11 additions and 2 deletions
|
@ -74,7 +74,8 @@ updateConfigCache = function () {
|
||||||
* @param {Object} settings
|
* @param {Object} settings
|
||||||
* @returns {Settings}
|
* @returns {Settings}
|
||||||
*/
|
*/
|
||||||
updateSettingsCache = function (settings) {
|
updateSettingsCache = function (settings, options) {
|
||||||
|
options = options || {};
|
||||||
settings = settings || {};
|
settings = settings || {};
|
||||||
|
|
||||||
if (!_.isEmpty(settings)) {
|
if (!_.isEmpty(settings)) {
|
||||||
|
@ -87,7 +88,7 @@ updateSettingsCache = function (settings) {
|
||||||
return Promise.resolve(settingsCache);
|
return Promise.resolve(settingsCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataProvider.Settings.findAll()
|
return dataProvider.Settings.findAll(options)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
settingsCache = readSettingsResult(result.models);
|
settingsCache = readSettingsResult(result.models);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
var config = require('../../../../config'),
|
var config = require('../../../../config'),
|
||||||
models = require(config.paths.corePath + '/server/models'),
|
models = require(config.paths.corePath + '/server/models'),
|
||||||
|
api = require(config.paths.corePath + '/server/api'),
|
||||||
sequence = require(config.paths.corePath + '/server/utils/sequence'),
|
sequence = require(config.paths.corePath + '/server/utils/sequence'),
|
||||||
moment = require('moment'),
|
moment = require('moment'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
|
@ -199,6 +200,9 @@ module.exports = function transformDatesIntoUTC(options, logger) {
|
||||||
key: 'migrations',
|
key: 'migrations',
|
||||||
value: JSON.stringify(settingsMigrations)
|
value: JSON.stringify(settingsMigrations)
|
||||||
}, options);
|
}, options);
|
||||||
|
},
|
||||||
|
function updateSettingsCache() {
|
||||||
|
return api.settings.updateSettingsCache(null, options);
|
||||||
}]
|
}]
|
||||||
).catch(function (err) {
|
).catch(function (err) {
|
||||||
if (err.message === 'skip') {
|
if (err.message === 'skip') {
|
||||||
|
|
|
@ -8,6 +8,7 @@ var should = require('should'),
|
||||||
// Stuff we are testing
|
// Stuff we are testing
|
||||||
configUtils = require('../utils/configUtils'),
|
configUtils = require('../utils/configUtils'),
|
||||||
models = require('../../server/models'),
|
models = require('../../server/models'),
|
||||||
|
api = require('../../server/api'),
|
||||||
notifications = require('../../server/api/notifications'),
|
notifications = require('../../server/api/notifications'),
|
||||||
versioning = require('../../server/data/schema/versioning'),
|
versioning = require('../../server/data/schema/versioning'),
|
||||||
update = rewire('../../server/data/migration/fixtures/update'),
|
update = rewire('../../server/data/migration/fixtures/update'),
|
||||||
|
@ -1035,6 +1036,7 @@ describe('Fixtures', function () {
|
||||||
model.set('id', Date.now());
|
model.set('id', Date.now());
|
||||||
model.set('created_at', createdAt);
|
model.set('created_at', createdAt);
|
||||||
model.set('key', model.id.toString());
|
model.set('key', model.id.toString());
|
||||||
|
model.set('name', modelType);
|
||||||
|
|
||||||
newModels[model.id] = model;
|
newModels[model.id] = model;
|
||||||
return Promise.resolve({models: [model]});
|
return Promise.resolve({models: [model]});
|
||||||
|
@ -1048,6 +1050,8 @@ describe('Fixtures', function () {
|
||||||
|
|
||||||
sandbox.stub(models[modelType], 'edit').returns(Promise.resolve({}));
|
sandbox.stub(models[modelType], 'edit').returns(Promise.resolve({}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sandbox.stub(api.settings, 'updateSettingsCache').returns(Promise.resolve({}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sqlite: no UTC update, only format', function (done) {
|
it('sqlite: no UTC update, only format', function (done) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue