diff --git a/scripts/_common.sh b/scripts/_common.sh index ad46f82..9d5c330 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,11 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.3" + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/actions/disable_maintenance b/scripts/actions/disable_maintenance index 6c3c679..03dd196 100755 --- a/scripts/actions/disable_maintenance +++ b/scripts/actions/disable_maintenance @@ -36,7 +36,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) if [ ! -e "$final_path/.maintenance" ] then - ynh_die --message="Wordpress isn't currently under maintenance." --ret_code=0 + ynh_die --message="WordPress isn't currently under maintenance." --ret_code=0 fi #================================================= diff --git a/scripts/actions/public_private b/scripts/actions/public_private index 397212c..d514a76 100755 --- a/scripts/actions/public_private +++ b/scripts/actions/public_private @@ -69,7 +69,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/actions/reset_default_app b/scripts/actions/reset_default_app index bdcafb5..fd1ab8d 100755 --- a/scripts/actions/reset_default_app +++ b/scripts/actions/reset_default_app @@ -40,7 +40,7 @@ ynh_maintenance_mode_ON # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config yunohost app action run $app reset_default_nginx @@ -57,7 +57,7 @@ ynh_system_user_create --username=$app # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated php-fpm config yunohost app action run $app reset_default_phpfpm @@ -86,7 +86,7 @@ find $final_path/ -type d -print0 | xargs -0 chmod 0755 #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=5 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=5 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: " --max_retry=5 @@ -109,7 +109,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/change_url b/scripts/change_url index d35f7a7..1ddec58 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -38,7 +38,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -82,25 +82,25 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=3 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# 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 + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -135,7 +135,7 @@ echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal wordpress #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 6e4b383..5ba7b22 100644 --- a/scripts/install +++ b/scripts/install @@ -83,9 +83,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=3 +ynh_script_progression --message="Configuring NGINX web server..." --weight=3 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -99,7 +99,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=2 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # If the app is private, set the usage to low, otherwise to high. if [ $is_public -eq 0 ] @@ -108,7 +108,7 @@ then else usage=high fi -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$usage --footprint=medium phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -117,7 +117,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CONFIGURE WP-CONFIG #================================================= -ynh_script_progression --message="Configuring wordpress..." +ynh_script_progression --message="Configuring WordPress..." cp ../conf/wp-config.php $final_path/wp-config.php # Change variables in Wordpress configuration @@ -134,15 +134,13 @@ done #================================================= # SETTING UP WITH CURL #================================================= -ynh_script_progression --message="Installing wordpress with Curl..." --weight=10 +ynh_script_progression --message="Installing wordpress with cURL..." --weight=10 -# Set right permissions for curl install +# Set right permissions for cURL install chown -R $app: $final_path -# Set the app as temporarily public for curl call -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -# Regen SSOwat configuration -yunohost app ssowatconf +# Set the app as temporarily public for cURL call +ynh_permission_update --permission "main" --add "visitors" # Reload Nginx ynh_systemd_action --service_name=nginx --action=reload @@ -246,7 +244,7 @@ chown root: $final_path/wp-config.php #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=7 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=7 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 @@ -258,14 +256,13 @@ ynh_script_progression --message="Configuring SSOwat..." if [ $is_public -eq 0 ] then - # Remove the public access - ynh_app_setting_delete --app=$app --key=unprotected_uris + ynh_permission_update --permission "main" --remove "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=3 +ynh_script_progression --message="Reloading NGINX web server..." --weight=3 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 72ae00d..f7ec142 100755 --- a/scripts/remove +++ b/scripts/remove @@ -41,15 +41,15 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -57,7 +57,7 @@ ynh_remove_fpm_config #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 # Remove the dedicated fail2ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index 06c945c..8927e42 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=6 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" @@ -116,7 +116,7 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index a00b33a..f40c431 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -161,13 +161,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # ACTIVATE MAINTENANCE MODE #================================================= @@ -182,7 +175,7 @@ ynh_maintenance_mode_ON # Overwrite the nginx configuration only if it's allowed if [ $overwrite_nginx -eq 1 ] then - ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 + ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_add_nginx_config fi @@ -201,7 +194,7 @@ ynh_system_user_create --username=$app # Overwrite the php-fpm configuration only if it's allowed if [ $overwrite_phpfpm -eq 1 ] then - ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=4 + ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint fi @@ -288,7 +281,7 @@ chown root: $final_path/wp-config.php #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=9 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=9 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 @@ -311,7 +304,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload