From 6b386c372ad5127a88c9ea0e50790b14c99517c0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 1 Oct 2021 09:11:49 +0200 Subject: [PATCH] Custom PHP version --- check_process | 21 ++++++++++++--------- manifest.json | 10 ++++++++++ scripts/_common.sh | 2 +- scripts/install | 2 ++ scripts/upgrade | 7 +++++++ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/check_process b/check_process index 32305ef..a38bc8f 100644 --- a/check_process +++ b/check_process @@ -1,10 +1,11 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" with_sftp=1 password="myreallystrengthpassword" - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 + php_custom="7.3" with_mysql=1 ; Checks pkg_linter=1 @@ -21,11 +22,12 @@ change_url=1 ;; Test without sftp ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" with_sftp=0 password="" - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 + php_custom="7.3" with_mysql=1 ; Checks setup_sub_dir=1 @@ -33,11 +35,12 @@ backup_restore=1 ;; Test without mysql ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" with_sftp=1 password="myreallystrengthpassword" - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 + php_custom="7.3" with_mysql=0 ; Checks setup_sub_dir=1 diff --git a/manifest.json b/manifest.json index eb4576a..b3b4697 100644 --- a/manifest.json +++ b/manifest.json @@ -59,6 +59,16 @@ "type": "boolean", "default": true }, + { + "name": "php_custom", + "type": "string", + "ask": { + "en": "Choose a PHP version you want to use for your app", + "fr": "Choisissez une version PHP que vous souhaitez utiliser pour votre application" + }, + "choices" : ["7.3", "7.4", "8.0"], + "default" : "7.3" + }, { "name": "with_mysql", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index f5c876d..3c8d0ba 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="$php_custom" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/install b/scripts/install index adfaf91..4428f8d 100644 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,7 @@ path_url=$YNH_APP_ARG_PATH with_sftp=$YNH_APP_ARG_WITH_SFTP password=$YNH_APP_ARG_PASSWORD is_public=$YNH_APP_ARG_IS_PUBLIC +php_custom=$YNH_APP_ARG_PHP_CUSTOM with_mysql=$YNH_APP_ARG_WITH_MYSQL @@ -52,6 +53,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=final_path --value=$final_path +ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 diff --git a/scripts/upgrade b/scripts/upgrade index edf7c39..8d5a9e6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) password=$(ynh_app_setting_get --app=$app --key=password) +php_custom=$(ynh_app_setting_get --app=$app --key=php_custom) admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) @@ -83,6 +84,12 @@ if [ -z "$with_sftp" ]; then ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp fi +# If with_sftp doesn't exist, create it +if [ -z "$php_custom" ]; then + php_custom="7.3" + ynh_app_setting_set --app=$app --key=php_custom --value=$php_custom +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all