From 0fd011cf807d5bfada5e49a75b0ed0a990ef6a4e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 8 Jun 2022 22:43:01 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e398d18..fb63f4e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,29 +51,16 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$sudo" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=sudo --value=1 - sudo=1 - # Removes sudo to www-data - if [ $(grep "www-data ALL=(ALL) NOPASSWD: ALL" /etc/sudoers | wc -l) -eq 0 ];then - sed -i "/www-data ALL=(ALL) NOPASSWD: ALL/d" /etc/sudoers - fi -elif [ "$sudo" = "No" ]; then - ynh_app_setting_set --app=$app --key=sudo --value=0 - sudo=0 +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public fi -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Create a permission if needed +if ! ynh_permission_exists --permission="api"; then + ynh_permission_create --permission="api" --url="/core/api/jeeApi.php" --allowed="visitors" --show_tile="false" --protected="true" fi #=================================================