diff --git a/scripts/change_url b/scripts/change_url index e4ce3a9..53cd35d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -48,15 +48,13 @@ fi # 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 ynh_add_nginx_config 'seahub_port fileserver_port webdav_port' diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index 4afaac3..d4e73f5 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -115,4 +115,15 @@ ynh_add_nginx_config () { ynh_store_file_checksum "$finalnginxconf" sudo systemctl reload nginx -} \ No newline at end of file +} + +# 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 +}