From fe4438b65e9e5ef88c7a07a05db7cb92db361c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Bilo=C3=A9?= Date: Fri, 28 Apr 2017 11:19:52 +0200 Subject: [PATCH] CO: Do not suggest automatic rollback after 1.7 upgrade --- AdminSelfUpgrade.php | 47 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/AdminSelfUpgrade.php b/AdminSelfUpgrade.php index 13c6ccd0b..d3f286dd1 100755 --- a/AdminSelfUpgrade.php +++ b/AdminSelfUpgrade.php @@ -4421,6 +4421,24 @@ protected function _displayRollbackForm() '; } + protected function _displayRollbackWarning() + { + $this->_html .= ' +
+ '.$this->l('Rollback').' +
+

+ '.sprintf( + $this->l('You are upgrading to a major version, please, be aware that the automatic rollback will not be available. You will still be able to manually rollback by following this %s how-to %s.'), + '', + '' + ).' +

+
 
+
+
'; + } + /** this returns fieldset containing the configuration points you need to use autoupgrade * @return string */ @@ -4979,7 +4997,11 @@ public function display() } } - $this->_displayRollbackForm(); + if(version_compare('1.7.0.0', _PS_VERSION_, '>=') || version_compare('1.7.0.0', $this->upgrader->version_num, '>=')) { + $this->_displayRollbackWarning(); + } else { + $this->_displayRollbackForm(); + } $this->_html .= ''; @@ -5076,6 +5098,11 @@ private function _upgradingTo17Step2() $this->l('I understand I will no longer have my advanced stock management configuration and data'), $this->l('I will have to reconfigure my permissions'), $this->l('If I have a custom menu in my back office, I will no longer be able to use it'), + sprintf( + $this->l('As I upgrade to a major version, I am aware that the automatic rollback will not be available. I will still be able to manually rollback by following this %s how-to %s'), + '', + '' + ), ); foreach ($lines as $k => $line) { @@ -5683,8 +5710,17 @@ function handleSuccess(res, action) // Way To Go, end of upgrade process addQuickInfo(["'.$this->l('End of process').'"]); } -} +}'; + if (version_compare($this->upgrader->version_num, '1.7.0.0', '>=')) { + $js .= ' +// res = {nextParams, next_desc} +function handleError(res, action) +{ + alert(\'An error happened and as you tried to upgrade to a major version, the automatic rollback is not available.\nYou are still able to manually rollback by following this how-to:\nhttp://doc.prestashop.com/display/PS16/Making+and+restoring+your+own+backup#Makingandrestoringyourownbackup-Restoringyourbackup\'); +}'; + } else { + $js .= ' // res = {nextParams, next_desc} function handleError(res, action) { @@ -5694,17 +5730,18 @@ function handleError(res, action) // auto rollback only if current action is upgradeFiles or upgradeDb if (action == "upgradeFiles" || action == "upgradeDb" || action == "upgradeModules" ) { - $(".button-autoupgrade").html("'.$this->l('Operation canceled. Checking for restoration...').'"); + $(".button-autoupgrade").html("' . $this->l('Operation canceled. Checking for restoration...') . '"); res.nextParams.restoreName = res.nextParams.backupName; - if (confirm("'.$this->l('Do you want to restore').' " + "'.$this->backupName.'" + " ?")) + if (confirm("' . $this->l('Do you want to restore') . ' " + "' . $this->upgrader->version_num. $this->backupName . '" + " ?")) doAjaxRequest("rollback",res.nextParams); } else { - $(".button-autoupgrade").html("'.$this->l('Operation canceled. An error happened.').'"); + $(".button-autoupgrade").html("' . $this->l('Operation canceled. An error happened.') . '"); $(window).unbind(); } }'; + } // ajax to check md5 files $js .= 'function addModifiedFileList(title, fileList, css_class, container) {