mirror of
https://github.com/YunoHost-Apps/wordpress_ynh.git
synced 2024-09-03 20:36:10 +02:00
35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
if [ $multisite -eq 1 ]
|
|
then
|
|
echo "A multisite installation of WordPress can't be moved easily. Please have a look at the WordPress codex to learn more about that." >&2
|
|
ynh_die "https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite"
|
|
fi
|
|
|
|
ynh_script_progression "Updating NGINX web server configuration..."
|
|
|
|
ynh_config_change_url_nginx
|
|
|
|
#=================================================
|
|
# UPDATE THE DATABASE
|
|
#=================================================
|
|
|
|
# Get the database table prefix
|
|
db_prefix=$(grep '^$table_prefix' "$install_dir/wp-config.php" | sed "s/.*'\(.*\)'.*/\1/" )
|
|
|
|
ynh_mysql_db_shell <<< "UPDATE ${db_prefix}options SET option_value='https://$new_domain$new_path' WHERE option_name='siteurl'"
|
|
|
|
ynh_mysql_db_shell <<< "UPDATE ${db_prefix}options SET option_value='https://$new_domain$new_path' WHERE option_name='home'"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Change of URL completed for $app"
|