From cbe4796a5629514a61757def9ae71852c2af30bd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 1 Apr 2019 18:18:37 +0200 Subject: [PATCH 1/2] Update version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 7bec3d1c..2dfbb7d8 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "ActivityPub Federated Image Sharing" }, - "version": "0.8.4~ynh1", + "version": "0.8.4~ynh2", "url": "https://pixelfed.org/", "license": "AGPL-3.0-or-later", "maintainer": { From 945fc891d768eab246eb516e7263f01f51f95db3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 1 Apr 2019 21:19:20 +0200 Subject: [PATCH 2/2] Fix change_url --- scripts/change_url | 48 ++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 60846630..a9530b5c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,10 +14,10 @@ source /usr/share/yunohost/helpers #================================================= old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +old_path="/" new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +new_path="/" app=$YNH_APP_INSTANCE_NAME @@ -43,12 +43,6 @@ then change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -58,18 +52,6 @@ ynh_print_info "Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different "$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config -fi - # Change the domain for nginx if [ $change_domain -eq 1 ] then @@ -83,9 +65,33 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= -# ... +# UPDATE CONFIG FILE #================================================= +config="$final_path/.env" +ynh_replace_string "APP_URL=.*" "APP_URL=https://$new_domain" "$config" +ynh_replace_string "ADMIN_DOMAIN=.*" "ADMIN_DOMAIN=\"$new_domain\"" "$config" +ynh_replace_string "APP_DOMAIN=.*" "APP_DOMAIN=\"$new_domain\"" "$config" +ynh_replace_string "MAIL_FROM_ADDRESS=.*" "MAIL_FROM_ADDRESS=\"pixelfed@$new_domain\"" "$config" + +#================================================= +# STORE THE CHECKSUM OF THE CONFIG FILE +#================================================= + +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum "$config" + +#================================================= +# APPLY CHANGES +#================================================= + +pushd "$final_path" + php7.2 artisan config:clear + php7.2 artisan config:cache + php7.2 artisan route:clear + php7.2 artisan route:cache + php7.2 artisan horizon:purge +popd #================================================= # GENERIC FINALISATION #=================================================