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

Use phpversion variable

This commit is contained in:
Kay0u 2020-09-21 17:21:33 +02:00
parent 708146cdb1
commit 253b7289c4
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
6 changed files with 20 additions and 9 deletions

View file

@ -24,7 +24,7 @@ location __PATH__/ {
client_max_body_size 30m;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;

View file

@ -18,12 +18,12 @@
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"yunohost": ">= 3.6"
"yunohost": ">= 3.8.1"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {

View file

@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# STANDARD BACKUP STEPS
@ -49,7 +50,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -110,6 +110,7 @@ else
fi
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=$usage --footprint=medium
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
@ -166,7 +167,7 @@ done
ynh_script_progression --message="Installing wordpress plugins..." --weight=20
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="php7.0 $final_path/wp-cli.phar --allow-root --path=$final_path"
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
$wpcli_alias plugin install simple-ldap-login
$wpcli_alias plugin install http-authentication

View file

@ -29,6 +29,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -93,7 +94,7 @@ chown root: $final_path/wp-config.php
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE FAIL2BAN CONFIGURATION
@ -117,7 +118,7 @@ ynh_restore_file "/etc/cron.d/$app"
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -32,6 +32,8 @@ admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
@ -128,9 +130,15 @@ if [ -z "$fpm_usage" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# If phpversion doesn't exist, create it
if [ -z "$phpversion" ]; then
phpversion=$YNH_PHP_VERSION
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
fi
# Replace wp-fail2ban by wp-fail2ban-redux
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
wpcli_alias="php7.0 $final_path/wp-cli.phar --allow-root --path=$final_path"
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
if [ $multisite -eq 1 ]; then
plugin_network="--network"
fi
@ -237,7 +245,7 @@ ynh_app_setting_set --app=$app --key=multisite --value=$multisite
ynh_script_progression --message="Updating plugins" --weight=11
# wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
# wpcli_alias="php7.0 $final_path/wp-cli.phar --allow-root --path=$final_path"
# wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
update_plugin () {
( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1
}