diff --git a/conf/nginx.conf b/conf/nginx.conf index 5ab5d4e..3c2a993 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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; diff --git a/manifest.json b/manifest.json index def192f..d1fbc1f 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/scripts/backup b/scripts/backup index eeea16b..7d943d5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/install b/scripts/install index b3b509d..6153a84 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/restore b/scripts/restore index 616904a..06c945c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 41abe1e..6ab0f42 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 }