1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galette_ynh.git synced 2024-09-03 18:36:28 +02:00

Fix missing $database during upgrade

This commit is contained in:
yalh76 2022-06-26 14:53:49 +02:00
parent c6287e0702
commit 814b1a2dda
5 changed files with 47 additions and 41 deletions

View file

@ -6,7 +6,7 @@
"en": "Membership management web application for non profit organizations",
"fr": "Outil de gestion d'adhérents et de cotisation en ligne pour associations"
},
"version": "0.9.5.2~ynh2",
"version": "0.9.5.2~ynh3",
"url": "https://www.galette.eu",
"upstream": {
"license": "GPL-3.0-or-later",

View file

@ -71,7 +71,7 @@ then
ynh_psql_dump_db --database="$db_name" > db.sql
else
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db --database="$db_name" > db.sql
fi
#=================================================

View file

@ -105,14 +105,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -122,6 +114,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================

View file

@ -43,13 +43,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -69,15 +62,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -91,6 +75,22 @@ fi
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE SQL DATABASE
#=================================================

View file

@ -54,6 +54,13 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# 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 "$app")
@ -72,11 +79,10 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
# If database doesn't exist, create it
if [ -z "$database" ]; then
database="pgsql"
ynh_app_setting_set --app=$app --key=database --value=$database
fi
#=================================================
@ -98,13 +104,13 @@ then
# Download, check integrity, uncompress and patch the source from app.src
mv "$final_path" "$final_path.old"
ynh_setup_source "$final_path"
#ynh_secure_remove "$final_path"/tests
ynh_setup_source --dest_dir="$final_path"
# when running automatic tests, there is no config.inc.php
if [ -e "$final_path.old/galette/config/config.inc.php" ]; then
cp "$final_path.old/galette/config/config.inc.php" "$final_path/galette/config/config.inc.php"
cp -r "$final_path.old/galette/data" "$final_path/galette/data"
cp -r "$final_path.old/galette/plugins" "$final_path/galette/plugins"
fi
# delete temp directory
@ -115,14 +121,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -143,6 +141,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================