2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Unlink import file when finished

fixes #2493
- Update db import version (in case it doesn't exist)
- Properly unlink file after import or error
This commit is contained in:
Fabian Becker 2014-03-24 09:29:31 +01:00
parent ae3c36797a
commit f0c6052c73

View file

@ -38,7 +38,7 @@ db = {
return api.settings.read({ key: 'databaseVersion' }).then(function (setting) {
return when(setting.value);
}, function () {
return when('001');
return when('002');
}).then(function (version) {
databaseVersion = version;
// Read the file contents
@ -82,6 +82,9 @@ db = {
return when.resolve({message: 'Posts, tags and other data successfully imported'});
}).otherwise(function importFailure(error) {
return when.reject({code: 500, message: error.message || error});
}).finally(function () {
// Unlink the file after import
return nodefn.call(fs.unlink, options.importfile.path);
});
},
'deleteAllContent': function () {