1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mediawiki_ynh.git synced 2024-09-03 19:46:05 +02:00
mediawiki_ynh/scripts/change_url

50 lines
1.4 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
#=================================================
# SET NEW URL
#=================================================
ynh_script_progression "Setting the new URL..."
if [ "$change_domain" -eq 1 ]; then
ynh_replace --file="$install_dir/LocalSettings.php" \
--match="\$wgServer = \"https://$old_domain\";" \
--replace="\$wgServer = \"https://$new_domain\";"
fi
if [ $change_path -eq 1 ]; then
if [ "$old_path" = "/" ]; then
old_scriptpath=""
else
old_scriptpath=$old_path
fi
if [ "$new_path" = "/" ]; then
new_scriptpath=""
else
new_scriptpath=$new_path
fi
ynh_replace --file="$install_dir/LocalSettings.php" \
--match="\$wgScriptPath = \"$old_scriptpath\";" \
--replace="\$wgScriptPath = \"$new_scriptpath\";"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Change of URL completed for $app"