1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
wallabag2_ynh/scripts/change_url
eric_G b9769d3c00
Testing (#215)
* Fix hook (#206)

* Auto-update READMEs

* fix hook

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update manifest.toml (#208)

* Update manifest.toml

* Auto-update READMEs

* Add parameters.yml (#209)

* Add parameters.yml

* Update upgrade

* Update change_url

* Function (#210)

* Add parameters.yml

* Update upgrade

* add function

* fix: add time for php script to run a 'long sync' with an application (#213)

* Auto-update READMEs

* [autopatch] Automatic patch attempt for helpers 2.1 (#214)

* Testing (#207)

* Fix hook (#206)

* Auto-update READMEs

* fix hook

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update manifest.toml (#208)

* Update manifest.toml

* Auto-update READMEs

* Add parameters.yml (#209)

* Add parameters.yml

* Update upgrade

* Update change_url

* Function (#210)

* Add parameters.yml

* Update upgrade

* add function

---------

Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update READMEs

* [autopatch] Automatic patch attempt for helpers 2.1

* cleaning

---------

Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: Yunohost-Bot <>

* Auto-update READMEs

* Update manifest.toml

* Auto-update READMEs

---------

Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
2024-09-09 22:24:42 +02:00

49 lines
1.8 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression "Updating NGINX web server configuration..."
ynh_config_change_url_nginx
#=================================================
# UPDATE CONFIGURATION
#=================================================
ynh_script_progression "Updating wallabag configuration..."
# Configure Wallabag instance URL
ynh_mysql_db_shell \
<<< "UPDATE internal_setting SET value = 'https://$new_domain$new_path' WHERE name = 'wallabag_url'"
# Change domain name in parameters.yml
ynh_replace --file="$install_dir/app/config/parameters.yml" --match="domain_name: .*" --replace="domain_name: https://$new_domain$new_path"
# If "Download images locally" option has been enabled in Internal Settings
download_images_enabled=$(ynh_mysql_db_shell \
<<< "SELECT value from internal_setting WHERE name='download_images_enabled '" | tail -n 1)
if [ "$download_images_enabled" = "1" ]; then
ynh_print_info "Updating images URL; this operation may take a while..."
# Query/replace the domain/path in every entry.content in mysql database
ynh_mysql_db_shell \
<<< "UPDATE entry SET content = REPLACE(content, '$old_domain$old_path', '$new_domain$new_path');"
fi
# Clear assets cache
ynh_safe_rm "$install_dir/var/cache"
mkdir "$install_dir/var/cache"
chown "$app:www-data" "$install_dir/var/cache"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Change of URL completed for $app"