1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osada_ynh.git synced 2024-09-03 19:46:30 +02:00

Fix upgrade

This commit is contained in:
yalh76 2022-06-24 03:07:31 +02:00
parent 792d07fd55
commit a6f9a3c80f

View file

@ -25,6 +25,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
database=$(ynh_app_setting_get --app=$app --key=database) database=$(ynh_app_setting_get --app=$app --key=database)
upload=$(ynh_app_setting_get --app=$app --key=upload) upload=$(ynh_app_setting_get --app=$app --key=upload)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -42,9 +49,9 @@ ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
# REMOVE APP MAIN DIR # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_print_info "Upgrading source files..." ynh_script_progression --message="Ensuring downward compatibility..."
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$final_path" ]; then
@ -65,14 +72,17 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
if [ $database -eq 1 ] 2>/dev/null; then # switch $database to "mysql" or "postgresql"
database="mysql" if [[ $database =~ '^[0-9]+$' ]]; then
ynh_app_setting_set --app=$app --key=database --value=$database if [ $database -eq 1 ] 2>/dev/null; then
elif [ $database -eq 2 ] 2>/dev/null; then database="mysql"
database="postgresql" ynh_app_setting_set --app=$app --key=database --value=$database
ynh_app_setting_set --app=$app --key=database --value=$database elif [ $database -eq 2 ] 2>/dev/null; then
else database="postgresql"
ynh_die --message="Some problem occured in creating the database, contact maintainer" ynh_app_setting_set --app=$app --key=database --value=$database
else
ynh_die --message="Some problem occured in creating the database, contact maintainer"
fi
fi fi
#================================================= #=================================================