diff --git a/scripts/upgrade b/scripts/upgrade index ed6a3aa..2ca6144 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,14 +80,26 @@ ynh_install_php7 version=`cd /var/www/$app && bin/console kimai:version --short 2> /dev/null || sed -n 's/^future-release=//p' .github_changelog_generator` # Uncompress latest sources +# Create a temporary directory +tmpdir="$(mktemp -d)" +# Backup the config file in the temp dir +cp -a "$final_path/.env" "$tmpdir/." +cp -a "$final_path/var/data" "$tmpdir/." + ynh_setup_source "$final_path" # If the version is 0.3, symfony update is required if [ "$version" = "0.3" ] then + ynh_secure_remove "$final_path" + ynh_setup_source "$final_path" init_symfony_update $final_path fi - +ynh_secure_remove "$final_path" +ynh_setup_source "$final_path" +sudo cp -a "$tmpdir/.env" "$final_path/." +sudo cp -af "$tmpdir/data" "$final_path/var/." +sudo rm -Rf "$tmpdir" init_composer $final_path ( cd $final_path && sudo /usr/bin/php7.2 bin/console cache:clear --env=prod