mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
e0edb6455d
closes #735 - make sure the importer gets loaded - additional preprocessing to ensure data can be loaded - removed old importers
31 lines
764 B
JavaScript
31 lines
764 B
JavaScript
var when = require('when');
|
|
|
|
module.exports = function (version, data) {
|
|
var importer;
|
|
|
|
try {
|
|
importer = require("./" + version);
|
|
} catch (ignore) {
|
|
// Zero effs given
|
|
}
|
|
|
|
if (!importer) {
|
|
return when.reject("No importer found");
|
|
}
|
|
|
|
return importer.importData(data).otherwise(function (err) {
|
|
if (err === "Unsupported version of data: 001" || err === "Unsupported version of data: 002") {
|
|
try {
|
|
importer = require("./temp.js");
|
|
} catch (ignore) {
|
|
// Zero effs given
|
|
}
|
|
|
|
if (!importer) {
|
|
return when.reject("No importer found");
|
|
}
|
|
|
|
return importer.importData(data);
|
|
}
|
|
});
|
|
};
|