diff --git a/scripts/_common.sh b/scripts/_common.sh index b44136a..27ce9e1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,9 @@ YNH_PHP_VERSION="7.3" # dependencies used by the app -pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick imagemagick" +pkg_dependencies="imagemagick" + +extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysqli" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 9905e2e..3ab6de3 100644 --- a/scripts/install +++ b/scripts/install @@ -139,7 +139,7 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -197,14 +197,14 @@ ynh_script_progression --message="Configuring LDAP plugin..." # Login with admin account ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$adm_pwd" -# Get session token +# Get session token status=$(ynh_local_curl "/ws.php?format=json" "method=pwg.session.getStatus") pwg_token=$(jq --raw-output .result.pwg_token <<< $status) # Install the Ldap_Login plugin ynh_local_curl "/ws.php?format=json" "method=pwg.plugins.performAction" "action=install" "plugin=Ldap_Login" "pwg_token=$pwg_token" # Activate the Ldap_Login plugin ynh_local_curl "/ws.php?format=json" "method=pwg.plugins.performAction" "action=activate" "plugin=Ldap_Login" "pwg_token=$pwg_token" -# Log out +# Log out ynh_local_curl "/ws.php?format=json" "method=pwg.session.logout" # Edit Ldap_Login plugin configuration diff --git a/scripts/restore b/scripts/restore index 00d0ac4..5d7a112 100644 --- a/scripts/restore +++ b/scripts/restore @@ -75,8 +75,13 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=10 +# 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 --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4ed1b97..b40cddd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -188,7 +188,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_add_fpm_config --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -242,12 +243,12 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< # Login with admin account ynh_local_curl "/ws.php?format=json" "method=pwg.session.login" "username=$admin" "password=$admin_pwd" -# Get session token +# Get session token status=$(ynh_local_curl "/ws.php?format=json" "method=pwg.session.getStatus") pwg_token=$(jq --raw-output .result.pwg_token <<< $status) # Activate the Ldap_Login plugin ynh_local_curl "/ws.php?format=json" "method=pwg.plugins.performAction" "action=activate" "plugin=Ldap_Login" "pwg_token=$pwg_token" -# Log out +# Log out ynh_local_curl "/ws.php?format=json" "method=pwg.session.logout" # Edit Ldap_Login plugin configuration