mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
parent
ca16b197a2
commit
a2f7160499
1 changed files with 59 additions and 56 deletions
|
@ -13,6 +13,7 @@ module.exports.config = {
|
|||
|
||||
const backupFileRegex = /ghost.([\d]{4}-[\d]{2}-[\d]{2}).json$/;
|
||||
|
||||
// @NOTE: spagetthi
|
||||
module.exports.up = (options) => {
|
||||
const contentPath = config.get('paths').contentPath;
|
||||
const dataPath = path.join(contentPath, 'data');
|
||||
|
@ -53,22 +54,23 @@ module.exports.up = (options) => {
|
|||
return;
|
||||
}
|
||||
const settings = backup && backup.data && backup.data.settings;
|
||||
const migrations = backup && backup.data && backup.data.migrations;
|
||||
|
||||
if (!settings) {
|
||||
common.logging.warn('Could not read settings from backup file, skipping...');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!migrations || !migrations.length) {
|
||||
common.logging.warn('Skipping migration. Not affected.');
|
||||
return localOptions
|
||||
.transacting('migrations')
|
||||
.then((response) => {
|
||||
if (!response) {
|
||||
common.logging.warn('Cannot find migrations.');
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: If we you have a backup file which has 2.16, but not 2.17, you are affected
|
||||
// NOTE: We have corrected 2.17. If you jump form 2.16 to 2.18, you are good
|
||||
const isAffected = _.find(migrations, {version: '2.16'}) &&
|
||||
!_.find(migrations, {version: '2.17'});
|
||||
// NOTE: You are only affected if you migrated to 2.17
|
||||
// 2.18 fixed the 2.17 migration (!)
|
||||
const isAffected = _.find(response, {currentVersion: '2.17', version: '2.17'});
|
||||
|
||||
if (!isAffected) {
|
||||
common.logging.warn('Skipping migration. Not affected.');
|
||||
|
@ -128,4 +130,5 @@ module.exports.up = (options) => {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue