diff --git a/scripts/change_url b/scripts/change_url index 083a45f..bd62b92 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,15 +31,13 @@ dbpass=$(ynh_app_setting_get "$app" mysqlpwd) # Update nginx config if [ "$old_domain" != "$domain" ] then - old_file_path="/etc/nginx/conf.d/$old_domain.d/$app.conf" - new_file_path="/etc/nginx/conf.d/$domain.d/$app.conf" - mv "$old_file_path" "$new_file_path" + # Delete file checksum for the old conf file location + ynh_delete_file_checksum "/etc/nginx/conf.d/$old_domain.d/$app.conf" - # Change the checksum setting name - checksum_setting_old_name=checksum_${old_file_path//[\/ ]/_} - checksum_setting_new_name=checksum_${new_file_path//[\/ ]/_} - checksum_value=$(ynh_app_setting_get $app $checksum_setting_old_name) - ynh_app_setting_set $app $checksum_setting_new_name $checksum_value + mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf" + + # Store file checksum for the new config file location + ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" fi config_nginx diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index fc6e9ff..b9e72d0 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -93,3 +93,14 @@ ynh_check_starting () { echo "" ynh_clean_check_starting } + +# Delete a file checksum from the app settings +# +# $app should be defined when calling this helper +# +# usage: ynh_remove_file_checksum file +# | arg: file - The file for which the checksum will be deleted +ynh_delete_file_checksum () { + local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' + ynh_app_setting_delete $app $checksum_setting_name +}