From 97df527c7c42118a35f72a322711c8ab88383b40 Mon Sep 17 00:00:00 2001 From: Alex Paliarush Date: Sun, 30 Oct 2016 22:58:10 -0500 Subject: [PATCH] Add Magento Upgrade Support #101 --- scripts/host/m_switch_to_ce.sh | 12 ++++++++++-- scripts/host/m_switch_to_ee.sh | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/host/m_switch_to_ce.sh b/scripts/host/m_switch_to_ce.sh index caa3d6eb5f2..5dc9f9b5bcc 100755 --- a/scripts/host/m_switch_to_ce.sh +++ b/scripts/host/m_switch_to_ce.sh @@ -18,9 +18,11 @@ checkout_source_from="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "check if [[ "${checkout_source_from}" == "git" ]]; then # Current installation is Git-based force_switch=0 - while getopts 'f' flag; do + upgrade_only=0 + while getopts 'fu' flag; do case "${flag}" in f) force_switch=1 ;; + u) upgrade_only=1 ;; *) error "Unexpected option" && decrementNestingLevel && exit 1;; esac done @@ -71,6 +73,12 @@ if [[ ${host_os} == "Windows" ]] || [[ $(bash "${vagrant_dir}/scripts/get_config read -p "$(warning "[Action Required] Wait while Magento2 code is uploaded in PhpStorm and press any key to continue...")" -n1 -s fi -bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError) +if [[ ${upgrade_only} -eq 1 ]]; then + bash "${vagrant_dir}/m-bin-magento" "setup:upgrade" 2> >(logError) + bash "${vagrant_dir}/m-bin-magento" "indexer:reindex" 2> >(logError) + bash "${vagrant_dir}/m-clear-cache" 2> >(logError) +else + bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError) +fi decrementNestingLevel diff --git a/scripts/host/m_switch_to_ee.sh b/scripts/host/m_switch_to_ee.sh index e427f3a4518..f145f782271 100755 --- a/scripts/host/m_switch_to_ee.sh +++ b/scripts/host/m_switch_to_ee.sh @@ -16,9 +16,11 @@ checkout_source_from="$(bash "${vagrant_dir}/scripts/get_config_value.sh" "check if [[ "${checkout_source_from}" == "git" ]]; then # Current installation is Git-based force_switch=0 - while getopts 'f' flag; do + upgrade_only=0 + while getopts 'fu' flag; do case "${flag}" in f) force_switch=1 ;; + u) upgrade_only=1 ;; *) error "Unexpected option" && decrementNestingLevel && exit 1;; esac done @@ -68,6 +70,12 @@ if [[ ${host_os} == "Windows" ]] || [[ $(bash "${vagrant_dir}/scripts/get_config read -p "$(warning "[Action Required] Wait while Magento2 code is uploaded in PhpStorm and press any key to continue...")" -n1 -s fi -bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError) +if [[ ${upgrade_only} -eq 1 ]]; then + bash "${vagrant_dir}/m-bin-magento" "setup:upgrade" 2> >(logError) + bash "${vagrant_dir}/m-bin-magento" "indexer:reindex" 2> >(logError) + bash "${vagrant_dir}/m-clear-cache" 2> >(logError) +else + bash "${vagrant_dir}/scripts/host/m_reinstall.sh" 2> >(logError) +fi decrementNestingLevel