From 4ddf61d007bc891250e1ecb4a4717c4153ab0ea8 Mon Sep 17 00:00:00 2001 From: anmol26s Date: Wed, 5 Sep 2018 18:46:38 +0530 Subject: [PATCH] If version 0.3 then do symfony update & -n for doctrine:migrations in upgrade --- scripts/_common.sh | 9 ++++----- scripts/upgrade | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b389eae..f54d90a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -105,7 +105,7 @@ sudo_path () { # Install and initialize Composer for upgrade script in the given directory # usage: init_composer DESTDIR [AS_USER] -init_composer_update() { +init_symfony_update() { local DESTDIR=$1 local AS_USER=${2:-admin} @@ -115,10 +115,9 @@ init_composer_update() { sudo /usr/bin/php7.2 -- --install-dir="$DESTDIR" \ || ynh_die "Unable to install Composer" - # update dependencies to create composer.lock - exec_composer "$DESTDIR" update symfony/flex --no-plugins --no-scripts - exec_composer "$DESTDIR" install --no-dev --optimize-autoloader \ - || ynh_die "Unable to update Kimai2 core dependencies" + # update symfony + exec_composer "$DESTDIR" update symfony/flex --no-plugins --no-scripts \ + || ynh_die "Unable to update symfony for Kimai2" } sudo_path () { diff --git a/scripts/upgrade b/scripts/upgrade index 6ff30a1..2c1e862 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,13 +74,25 @@ ynh_install_php7 # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -# Download, check integrity, uncompress and patch the source from app.src +# Download, check integrity, uncompress and patch the source from app.src and do required installation for update + +#version check for 0.3 +version = sed -n 's/^future-release=//p' $final_path/.github_changelog_generator + +# Uncompress latest sources ynh_setup_source "$final_path" -init_composer_update $final_path + +# If the version is 0.3, symfony update is required +if [ "$version" = "0.3" ] +then + init_symfony_update $final_path +fi + +init_composer $final_path ( cd $final_path && sudo /usr/bin/php7.2 bin/console cache:clear --env=prod cd $final_path && sudo /usr/bin/php7.2 bin/console cache:warmup --env=prod -cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:migrations:migrate +cd $final_path && sudo /usr/bin/php7.2 bin/console doctrine:migrations:migrate -n ) #================================================= # NGINX CONFIGURATION