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:
parent
708146cdb1
commit
253b7289c4
6 changed files with 20 additions and 9 deletions
|
@ -24,7 +24,7 @@ location __PATH__/ {
|
||||||
client_max_body_size 30m;
|
client_max_body_size 30m;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.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;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
"email": "maniackc_dev@crudelis.fr"
|
"email": "maniackc_dev@crudelis.fr"
|
||||||
}],
|
}],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.6"
|
"yunohost": ">= 3.8.1"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php7.0-fpm",
|
"php7.3-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|
|
@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# 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_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
|
# BACKUP THE MYSQL DATABASE
|
||||||
|
|
|
@ -110,6 +110,7 @@ else
|
||||||
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
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -166,7 +167,7 @@ done
|
||||||
ynh_script_progression --message="Installing wordpress plugins..." --weight=20
|
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
|
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 simple-ldap-login
|
||||||
$wpcli_alias plugin install http-authentication
|
$wpcli_alias plugin install http-authentication
|
||||||
|
|
|
@ -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)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -93,7 +94,7 @@ chown root: $final_path/wp-config.php
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# 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
|
# 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_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
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||||
|
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -128,9 +130,15 @@ if [ -z "$fpm_usage" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||||
fi
|
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
|
# 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
|
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
|
if [ $multisite -eq 1 ]; then
|
||||||
plugin_network="--network"
|
plugin_network="--network"
|
||||||
fi
|
fi
|
||||||
|
@ -237,7 +245,7 @@ ynh_app_setting_set --app=$app --key=multisite --value=$multisite
|
||||||
ynh_script_progression --message="Updating plugins" --weight=11
|
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
|
# 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 () {
|
update_plugin () {
|
||||||
( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1
|
( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue