From ea18c96969ee34fc023a56bfd4759a9cada4b15d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 15 Jul 2020 18:16:00 +0200 Subject: [PATCH] Revert "php" This reverts commit 5ec310465760a8ce47d9e00c374a9a0527f1501a. --- check_process | 9 +++++---- scripts/_common.sh | 4 +--- scripts/backup | 3 +-- scripts/install | 16 +++++++++------- scripts/restore | 16 ++++++++++++++-- scripts/upgrade | 15 +++++++++++++-- 6 files changed, 43 insertions(+), 20 deletions(-) diff --git a/check_process b/check_process index 586f849..6da670e 100644 --- a/check_process +++ b/check_process @@ -6,19 +6,20 @@ ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) - root_access=1 + root_access=0 is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 setup_sub_dir=1 - setup_root=1 + setup_root=0 setup_nourl=1 - setup_private=1 + setup_private=0 setup_public=1 upgrade=1 backup_restore=1 multi_instance=1 - #incorrect_path=1 + # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. + # incorrect_path=1 port_already_use=0 (66) change_url=1 ;;;; Levels diff --git a/scripts/_common.sh b/scripts/_common.sh index c0aacd4..9ea8430 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,9 +5,7 @@ #================================================= # dependencies used by the app -extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-pgsql" - -YNH_PHP_VERSION="7.3" +pkg_dependencies="php7.0-mysql php7.0-sqlite3 php7.0-pgsql" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index aee48a7..69abc4f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,6 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -54,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index e7e7fdd..4a3b933 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -88,7 +92,7 @@ ynh_system_user_create --username=$app # Set permissions to app files chown -R www-data:www-data $final_path -chmod -R 755 $final_path/adminer.php +chmod 755 -R $final_path/adminer.php #================================================= # NGINX CONFIGURATION @@ -104,20 +108,18 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-fpm..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) +ynh_add_fpm_config #================================================= # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=1 -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission "main" --add "visitors" + # unprotected_uris allows SSO credentials to be passed anyway. + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi #================================================= diff --git a/scripts/restore b/scripts/restore index cf579c1..bb80ac7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + #### Remove this function if there's nothing to clean before calling the remove script. + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -53,6 +57,14 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -73,7 +85,7 @@ chmod 755 -R $final_path/adminer.php # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION @@ -82,7 +94,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-fpm..." --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=php7.0-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ee6fa0f..fdf4edb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) root_access=$(ynh_app_setting_get --app=$app --key=root_access) -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -102,7 +101,19 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config + +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + # unprotected_uris allows SSO credentials to be passed anyway + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +fi #================================================= # RELOAD NGINX