From d3cd7aced40a03f5642ef0712bed2b8ad2f72f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Mon, 4 Aug 2014 10:49:49 +0200 Subject: [PATCH] Made changes to structure of upgrades.js. Makes it possible in the future to add stuff for a upgrade --- js/h5p-content-upgrade.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/h5p-content-upgrade.js b/js/h5p-content-upgrade.js index d23ed24..5542bdd 100644 --- a/js/h5p-content-upgrade.js +++ b/js/h5p-content-upgrade.js @@ -361,10 +361,15 @@ var H5PUpgrades = H5PUpgrades || {}; } else { // We found an upgrade hook, run it - upgrade(params, function (err, upgradedParams) { - params = upgradedParams; - nextMinor(err); - }); + if (upgrade.contentUpgrade !== undefined && typeof upgrade.contentUpgrade === 'function') { + upgrade.contentUpgrade(params, function (err, upgradedParams) { + params = upgradedParams; + nextMinor(err); + }); + } + else { + nextMinor(info.errorScript.replace('%lib', library.name + ' ' + newVersion)); + } } }, nextMajor); }