#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 ynh_change_url_nginx_config #================================================= # UPDATE CONFIGURATION #================================================= ynh_script_progression --message="Updating wallabag configuration..." # Configure Wallabag instance URL ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ <<< "UPDATE internal_setting SET value = 'https://$new_domain$new_path' WHERE name = 'wallabag_url'" # Change domain name in parameters.yml ynh_replace_string --target_file="$wb_conf" --match_string="domain_name: .*" --replace_string="domain_name: https://$new_domain$new_path" # If "Download images locally" option has been enabled in Internal Settings download_images_enabled=$(ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ <<< "SELECT value from internal_setting WHERE name='download_images_enabled '" | tail -n 1) if [ "$download_images_enabled" = "1" ]; then ynh_print_info --message="Updating images URL; this operation may take a while..." # Query/replace the domain/path in every entry.content in mysql database ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ <<< "UPDATE entry SET content = REPLACE(content, '$old_domain$old_path', '$new_domain$new_path');" fi #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Change of URL completed for $app" --last