1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wordpress_ynh.git synced 2024-09-03 20:36:10 +02:00

Merge pull request #116 from YunoHost-Apps/testing

Testing
This commit is contained in:
Kayou 2020-12-28 22:08:54 +01:00 committed by GitHub
commit 28322dbbcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 94 additions and 83 deletions

View file

@ -4,6 +4,11 @@ Changelog
## Unreleased ## Unreleased
- Nothing for now... - Nothing for now...
## [5.6~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115) - 2020-12-09
#### Changed
* [Update to 5.6](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/2d72bf87c3e2e674e967058472586b31e0cb5c62)
## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15 ## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15
#### Fixed #### Fixed

View file

@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
WordPress is open source software you can use to create a beautiful website, blog, or app. WordPress is open source software you can use to create a beautiful website, blog, or app.
With this package, you can even activate the [multisite](https://codex.wordpress.org/Glossary#Multisite) option. With this package, you can even activate the [multisite](https://codex.wordpress.org/Glossary#Multisite) option.
**Shipped version:** 5.5.3 **Shipped version:** 5.6
## Screenshots ## Screenshots
@ -25,7 +25,7 @@ Use the admin panel of your WordPress to configure this app.
## Documentation ## Documentation
* Official documentation: https://codex.wordpress.org/ * Official documentation: https://codex.wordpress.org/
* YunoHost documentation: There no other documentations, feel free to contribute. * YunoHost documentation: https://yunohost.org/#/app_wordpress
## YunoHost specific features ## YunoHost specific features

View file

@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install
WordPress est un logiciel libre que vous pouvez utiliser pour créer un site ou un blog. WordPress est un logiciel libre que vous pouvez utiliser pour créer un site ou un blog.
Avec ce package, vous pouvez même activer l'option [multisite](https://codex.wordpress.org/Glossary#Multisite). Avec ce package, vous pouvez même activer l'option [multisite](https://codex.wordpress.org/Glossary#Multisite).
**Version incluse :** 5.5.3 **Version incluse :** 5.6
## Captures d'écran ## Captures d'écran
@ -25,7 +25,7 @@ Utilisez le panneau d'administration de votre WordPress pour le configurer.
## Documentation ## Documentation
* Documentation officielle : https://codex.wordpress.org/ * Documentation officielle : https://codex.wordpress.org/
* Documentation YunoHost : https://yunohost.org/#/app_wordpress * Documentation YunoHost : https://yunohost.org/#/app_wordpress_fr
## Caractéristiques spécifiques YunoHost ## Caractéristiques spécifiques YunoHost

View file

@ -7,27 +7,27 @@ description = "Change the public access of the app."
[public_private.arguments] [public_private.arguments]
[public_private.arguments.is_public] [public_private.arguments.is_public]
type = "boolean" type = "boolean"
ask = "Is it a public app ?" ask = "Is it a public app?"
default = true default = true
[reset_default_nginx] [reset_default_nginx]
name = "Reset the nginx config for this app." name = "Reset the NGINX config for this app."
command = "/bin/bash scripts/actions/reset_default_system nginx" command = "/bin/bash scripts/actions/reset_default_system nginx"
# user = "root" # optional # user = "root" # optional
# cwd = "/" # optional # cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional # accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0] accepted_return_codes = [0]
description = "Reset the nginx config for this app." description = "Reset the NGINX config for this app."
[reset_default_phpfpm] [reset_default_phpfpm]
name = "Reset the php-fpm config for this app." name = "Reset the PHP-FPM config for this app."
command = "/bin/bash scripts/actions/reset_default_system phpfpm" command = "/bin/bash scripts/actions/reset_default_system phpfpm"
# user = "root" # optional # user = "root" # optional
# cwd = "/" # optional # cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional # accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0] accepted_return_codes = [0]
description = "Reset the php-fpm config for this app." description = "Reset the PHP-FPM config for this app."
[reset_default_app] [reset_default_app]
@ -41,10 +41,10 @@ description = "Reset the app to its default configuration to try to fix potentia
[disable_maintenance] [disable_maintenance]
name = "Disable the maintenance mode of Wordpress" name = "Disable the maintenance mode of WordPress"
command = "/bin/bash scripts/actions/disable_maintenance" command = "/bin/bash scripts/actions/disable_maintenance"
# user = "root" # optional # user = "root" # optional
# cwd = "/" # optional # cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional # accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0] accepted_return_codes = [0]
description = "Disable the maintenance mode of Wordpress if you're stuck after an upgrade" description = "Disable the maintenance mode of WordPress if you're stuck after an upgrade"

View file

@ -48,8 +48,6 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=change Notification=change

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://wordpress.org/wordpress-5.5.3.tar.gz SOURCE_URL=https://wordpress.org/wordpress-5.6.tar.gz
SOURCE_SUM=c9220f0d5c9c593412da6c0193e43d94 SOURCE_SUM=47f466f375557bd4e3e1fff69b1ccbe29053423736b1af8f3dbf9d38c4c5fcd3
SOURCE_SUM_PRG=md5sum SOURCE_SUM_PRG=sha256sum
ARCH_FORMAT=tar.gz ARCH_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=

View file

@ -9,7 +9,7 @@ name = "Wordpress configuration"
name = "Public access" name = "Public access"
[main.is_public.is_public] [main.is_public.is_public]
ask = "Is it a public WordPress site ?" ask = "Is it a public WordPress site?"
type = "boolean" type = "boolean"
default = true default = true
@ -18,13 +18,13 @@ name = "Wordpress configuration"
name = "Overwriting config files" name = "Overwriting config files"
[main.overwrite_files.overwrite_nginx] [main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?" ask = "Overwrite the NGINX config file?"
type = "boolean" type = "boolean"
default = true default = true
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_phpfpm] [main.overwrite_files.overwrite_phpfpm]
ask = "Overwrite the php-fpm config file ?" ask = "Overwrite the PHP-FPM config file?"
type = "boolean" type = "boolean"
default = true default = true
help = "If the file is overwritten, a backup will be created." help = "If the file is overwritten, a backup will be created."
@ -34,7 +34,7 @@ name = "Wordpress configuration"
name = "Global configuration" name = "Global configuration"
[main.global_config.email_type] [main.global_config.email_type]
ask = "Send HTML email to admin ?" ask = "Send HTML email to admin?"
type = "boolean" type = "boolean"
default = true default = true
help = "Allow app scripts to send HTML mails instead of plain text." help = "Allow app scripts to send HTML mails instead of plain text."
@ -44,25 +44,25 @@ name = "Wordpress configuration"
name = "PHP-FPM configuration" name = "PHP-FPM configuration"
[main.php_fpm_config.footprint] [main.php_fpm_config.footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"] choices = ["low", "medium", "high", "specific"]
default = "low" default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option." help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint] [main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service ?" ask = "Memory footprint of the service?"
type = "number" type = "number"
default = "0" default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.usage] [main.php_fpm_config.usage]
ask = "Expected usage of the service ?" ask = "Expected usage of the service?"
choices = ["low", "medium", "high"] choices = ["low", "medium", "high"]
default = "low" default = "low"
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
[main.php_fpm_config.force_max_children] [main.php_fpm_config.force_max_children]
ask = "Force the value of pm.max_children ?" ask = "Force the value of pm.max_children?"
type = "number" type = "number"
default = "0" default = "0"
help = "Do not change this value unless you're sure about what you're doing !<br>pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint<br>You can force that value, and ignore the formula by changing the value here.<br>To reset to the default value, set to 0." help = "Do not change this value unless you are sure about what you are doing!<br>pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint<br>You can force that value, and ignore the formula by changing the value here.<br>To reset to the default value, set to 0."

View file

@ -6,7 +6,7 @@
"en": "Create a beautiful blog or website easily", "en": "Create a beautiful blog or website easily",
"fr": "Logiciel de création de blog ou de site Web" "fr": "Logiciel de création de blog ou de site Web"
}, },
"version": "5.5.3~ynh1", "version": "5.6~ynh1",
"url": "https://wordpress.org/", "url": "https://wordpress.org/",
"license": "GPL-2.0", "license": "GPL-2.0",
"maintainer": { "maintainer": {

View file

@ -1,5 +1,13 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-ssh2 php${YNH_PHP_VERSION}-tokenizer"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -36,7 +36,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
if [ ! -e "$final_path/.maintenance" ] if [ ! -e "$final_path/.maintenance" ]
then 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 fi
#================================================= #=================================================

View file

@ -69,7 +69,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -40,7 +40,7 @@ ynh_maintenance_mode_ON
# NGINX CONFIGURATION # 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 # Create a dedicated nginx config
yunohost app action run $app reset_default_nginx yunohost app action run $app reset_default_nginx
@ -57,7 +57,7 @@ ynh_system_user_create --username=$app
# PHP-FPM CONFIGURATION # 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 # Create a dedicated php-fpm config
yunohost app action run $app reset_default_phpfpm yunohost app action run $app reset_default_phpfpm
@ -86,7 +86,7 @@ find $final_path/ -type d -print0 | xargs -0 chmod 0755
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=5 ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=5
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5
@ -109,7 +109,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -31,14 +31,14 @@ multisite=$(ynh_app_setting_get --app=$app --key=multisite)
if [ $multisite -eq 1 ] if [ $multisite -eq 1 ]
then 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 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 --message="https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite" ynh_die --message="https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite"
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # 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 # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -82,25 +82,25 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # 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 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 ] if [ $change_path -eq 1 ]
then 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" 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" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # 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 # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -83,9 +83,9 @@ ynh_setup_source --dest_dir="$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # 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 ynh_add_nginx_config
#================================================= #=================================================
@ -99,7 +99,7 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # 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 the app is private, set the usage to low, otherwise to high.
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
@ -108,8 +108,8 @@ then
else else
usage=high usage=high
fi fi
# Create a dedicated php-fpm config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$usage --footprint=medium ynh_add_fpm_config --usage=$usage --footprint=medium --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) 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 # 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 cp ../conf/wp-config.php $final_path/wp-config.php
# Change variables in Wordpress configuration # Change variables in Wordpress configuration
@ -134,17 +134,17 @@ done
#================================================= #=================================================
# SETTING UP WITH CURL # 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 chown -R $app: $final_path
# Set the app as temporarily public for curl call # Set the app as temporarily public for cURL call
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# Regen SSOwat configuration # Regen SSOwat configuration
yunohost app ssowatconf yunohost app ssowatconf
# Reload Nginx # Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
# Wordpress installation # Wordpress installation
@ -153,9 +153,9 @@ ynh_local_curl "/wp-admin/install.php?step=2" "&weblog_title=YunoBlog" "user_nam
ynh_print_info --message="Please wait during Wordpress installation..." ynh_print_info --message="Please wait during Wordpress installation..."
for i in `seq 1 300` for i in `seq 1 300`
do do
# The loop waits for wordpress to be installed, or 5 minutes. # The loop waits for WordPress to be installed, or 5 minutes.
if ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "show tables" | grep --quiet "wp_options"; then if ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "show tables" | grep --quiet "wp_options"; then
# If the table wp_options is found, wordpress has finished its installation. # If the table wp_options is found, WordPress has finished its installation.
break break
fi fi
sleep 1 sleep 1
@ -164,7 +164,7 @@ done
#================================================= #=================================================
# INSTALL WORDPRESS PLUGINS # INSTALL WORDPRESS PLUGINS
#================================================= #=================================================
ynh_script_progression --message="Installing wordpress plugins..." --weight=20 ynh_script_progression --message="Installing WordPress plugins..." --weight=20
ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path" wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
@ -228,7 +228,7 @@ ynh_store_file_checksum --file="$final_path/wp-config.php"
# CREATE A CRON TASK FOR AUTOMATIC UPDATE # CREATE A CRON TASK FOR AUTOMATIC UPDATE
#================================================= #=================================================
echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal wordpress cron. echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal WordPress cron.
0 3 * * * root wget -q -O - https://$domain$path_url/wp-cron.php?doing_wp_cron >/dev/null 2>&1" > /etc/cron.d/$app 0 3 * * * root wget -q -O - https://$domain$path_url/wp-cron.php?doing_wp_cron >/dev/null 2>&1" > /etc/cron.d/$app
#================================================= #=================================================
@ -246,9 +246,9 @@ chown root: $final_path/wp-config.php
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Configuring fail2ban..." --weight=7 ynh_script_progression --message="Configuring Fail2Ban..." --weight=7
# Create a dedicated fail2ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5
#================================================= #=================================================
@ -265,7 +265,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -41,25 +41,25 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # 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 ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # 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 # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # 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 # Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
#================================================= #=================================================

View file

@ -31,6 +31,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
admin_wordpress=$(ynh_app_setting_get --app=$app --key=admin) admin_wordpress=$(ynh_app_setting_get --app=$app --key=admin)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
@ -94,12 +97,16 @@ chown root: $final_path/wp-config.php
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#================================================= #=================================================
# RESTORE THE FAIL2BAN CONFIGURATION # 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/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
@ -116,7 +123,7 @@ ynh_restore_file "/etc/cron.d/$app"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # 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=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -161,13 +161,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors 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 # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
@ -179,10 +172,10 @@ ynh_maintenance_mode_ON
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# Overwrite the nginx configuration only if it's allowed # Overwrite the NGINX configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ] if [ $overwrite_nginx -eq 1 ]
then 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 ynh_add_nginx_config
fi fi
@ -198,12 +191,12 @@ ynh_system_user_create --username=$app
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
# Overwrite the php-fpm configuration only if it's allowed # Overwrite the PHP-FPM configuration only if it's allowed
if [ $overwrite_phpfpm -eq 1 ] if [ $overwrite_phpfpm -eq 1 ]
then 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 # Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
fi fi
#================================================= #=================================================
@ -288,9 +281,9 @@ chown root: $final_path/wp-config.php
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=9 ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=9
# Create a dedicated fail2ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5
#================================================= #=================================================
@ -311,7 +304,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload