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 #115 from YunoHost-Apps/v.5.6

Upgrade to V.5.6
This commit is contained in:
Kayou 2020-12-11 18:59:26 +01:00 committed by GitHub
commit 94d190719d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 95 additions and 86 deletions

View file

@ -4,6 +4,11 @@ Changelog
## Unreleased
- 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
#### 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.
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
@ -25,7 +25,7 @@ Use the admin panel of your WordPress to configure this app.
## Documentation
* 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

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.
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
@ -25,7 +25,7 @@ Utilisez le panneau d'administration de votre WordPress pour le configurer.
## Documentation
* 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

View file

@ -11,23 +11,23 @@ description = "Change the public access of the app."
default = true
[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"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Reset the nginx config for this app."
description = "Reset the NGINX config for this app."
[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"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
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]
@ -41,10 +41,10 @@ description = "Reset the app to its default configuration to try to fix potentia
[disable_maintenance]
name = "Disable the maintenance mode of Wordpress"
name = "Disable the maintenance mode of WordPress"
command = "/bin/bash scripts/actions/disable_maintenance"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
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
backup_restore=1
multi_instance=1
;;; Levels
Level 5=auto
;;; Options
Email=
Notification=change

View file

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

View file

@ -18,13 +18,13 @@ name = "Wordpress configuration"
name = "Overwriting config files"
[main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?"
ask = "Overwrite the NGINX config file?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_phpfpm]
ask = "Overwrite the php-fpm config file ?"
ask = "Overwrite the PHP-FPM config file?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
@ -59,10 +59,10 @@ name = "Wordpress configuration"
ask = "Expected usage of the service?"
choices = ["low", "medium", "high"]
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]
ask = "Force the value of pm.max_children?"
type = "number"
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",
"fr": "Logiciel de création de blog ou de site Web"
},
"version": "5.5.3~ynh1",
"version": "5.6~ynh1",
"url": "https://wordpress.org/",
"license": "GPL-2.0",
"maintainer": {

View file

@ -1,5 +1,13 @@
#!/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
#=================================================

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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: <HOST>" --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

View file

@ -31,14 +31,14 @@ multisite=$(ynh_app_setting_get --app=$app --key=multisite)
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
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"
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

View file

@ -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,8 +108,8 @@ then
else
usage=high
fi
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=$usage --footprint=medium
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$usage --footprint=medium --package="$extra_php_dependencies"
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,17 +134,15 @@ 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
# Reload NGINX
ynh_systemd_action --service_name=nginx --action=reload
# Wordpress installation
@ -153,9 +151,9 @@ ynh_local_curl "/wp-admin/install.php?step=2" "&weblog_title=YunoBlog" "user_nam
ynh_print_info --message="Please wait during Wordpress installation..."
for i in `seq 1 300`
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 the table wp_options is found, wordpress has finished its installation.
# If the table wp_options is found, WordPress has finished its installation.
break
fi
sleep 1
@ -164,7 +162,7 @@ done
#=================================================
# 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
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
@ -228,7 +226,7 @@ ynh_store_file_checksum --file="$final_path/wp-config.php"
# 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
#=================================================
@ -246,9 +244,9 @@ 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
# 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
#=================================================
@ -265,7 +263,7 @@ 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

View file

@ -41,25 +41,25 @@ 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
# Remove the dedicated PHP-FPM config
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
# Remove the dedicated 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)
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
#=================================================
@ -94,12 +97,16 @@ chown root: $final_path/wp-config.php
# 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"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#=================================================
# 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 +123,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

View file

@ -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
#=================================================
@ -179,10 +172,10 @@ ynh_maintenance_mode_ON
# 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 ]
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
@ -198,12 +191,12 @@ ynh_system_user_create --username=$app
# 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 ]
then
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
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 --package="$extra_php_dependencies"
fi
#=================================================
@ -288,9 +281,9 @@ 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
# 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
#=================================================
@ -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