From 201d67af8b8177893d6aa3d4eaa645e9110b1c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:59:44 +0100 Subject: [PATCH 1/6] remove db choice --- conf/config.inc.php.mysql | 25 ------------------------- doc/PRE_UPGRADE.md | 1 + manifest.toml | 19 +++---------------- scripts/backup | 10 ++-------- scripts/install | 30 +----------------------------- scripts/remove | 8 -------- scripts/restore | 16 +++------------- scripts/upgrade | 13 ------------- tests.toml | 5 ----- 9 files changed, 10 insertions(+), 117 deletions(-) delete mode 100644 conf/config.inc.php.mysql create mode 100644 doc/PRE_UPGRADE.md diff --git a/conf/config.inc.php.mysql b/conf/config.inc.php.mysql deleted file mode 100644 index 1c6445c..0000000 --- a/conf/config.inc.php.mysql +++ /dev/null @@ -1,25 +0,0 @@ - db.sql -else - ynh_print_info --message="Backing up the MySQL database..." - ynh_mysql_dump_db --database="$db_name" > db.sql -fi +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 949a71c..832147c 100644 --- a/scripts/install +++ b/scripts/install @@ -15,29 +15,6 @@ source /usr/share/yunohost/helpers timezone="$(cat /etc/timezone)" -#================================================= -# CREATE A SQL DATABASE -#================================================= - -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -db_pwd=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_user --value=$db_user -ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd - -if [ $database == "postgresql" ] -then - ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 - ynh_psql_test_if_first_run - ynh_psql_setup_db --db_user=$db_user --db_name=$db_name - ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd -else - ynh_script_progression --message="Creating a MySQL database..." --weight=2 - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name - ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -84,12 +61,7 @@ ynh_script_progression --message="Setuping application with CURL..." ynh_script_progression --message="Finalizing installation..." ynh_local_curl "/installer.php" "install_permsok=1" ynh_local_curl "/installer.php" "install_type=i" -if [ $database == "postgresql" ] -then - ynh_local_curl "/installer.php" "install_dbtype=pgsql" "install_dbhost=localhost" "install_dbport=5432" "install_dbuser=$db_user" "install_dbpass=$db_pwd" "install_dbname=$db_name" "install_dbprefix=galette_" -else - ynh_local_curl "/installer.php" "install_dbtype=mysql" "install_dbhost=localhost" "install_dbport=3306" "install_dbuser=$db_user" "install_dbpass=$db_pwd" "install_dbname=$db_name" "install_dbprefix=galette_" -fi +ynh_local_curl "/installer.php" "install_dbtype=pgsql" "install_dbhost=localhost" "install_dbport=5432" "install_dbuser=$db_user" "install_dbpass=$db_pwd" "install_dbname=$db_name" "install_dbprefix=galette_" ynh_local_curl "/installer.php" "install_dbperms_ok=1" ynh_local_curl "/installer.php" "install_dbwrite_ok=1" ynh_local_curl "/installer.php" "install_adminlogin=$admin" "install_adminpass=$password" "install_adminpass_verif=$password" diff --git a/scripts/remove b/scripts/remove index 0f5e210..7a8278f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,14 +23,6 @@ ynh_remove_nginx_config # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -if [ $database == "postgresql" ] -then - ynh_script_progression --message="Removing PostgreSQL database..." --weight=2 - ynh_psql_remove_db --db_user=$db_user --db_name=$db_name -else - ynh_script_progression --message="Removing MySQL database..." --weight=2 - ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -fi #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index f537eb7..374a644 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,21 +27,11 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# RESTORE THE SQL DATABASE +# RESTORE THE POSTGRESQL DATABASE #================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - -if [ $database == "postgresql" ] -then - ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd - ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -else - ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd - ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -fi +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 8bda4ba..64444cd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,20 +29,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - # Download, check integrity, uncompress and patch the source from app.src - #mv "$install_dir" "$install_dir.old" - ynh_setup_source --dest_dir="$install_dir" --keep="galette/config/config.inc.php galette/data galette/plugins" - - # when running automatic tests, there is no config.inc.php - #if [ -e "$install_dir.old/galette/config/config.inc.php" ]; then - # cp "$install_dir.old/galette/config/config.inc.php" "$install_dir/galette/config/config.inc.php" - # cp -r "$install_dir.old/galette/data" "$install_dir/galette/data" - # cp -r "$install_dir.old/galette/plugins" "$install_dir/galette/plugins" - #fi - - # delete temp directory - #ynh_secure_remove "$install_dir.old" fi chmod -R o-rwx "$install_dir" diff --git a/tests.toml b/tests.toml index 1966c23..3ecfeb8 100644 --- a/tests.toml +++ b/tests.toml @@ -6,13 +6,8 @@ test_format = 1.0 # Default args to use for install # ------------------------------- - args.database="postgresql" # ------------------------------- # Commits to test upgrade from # ------------------------------- - [mysql_test] - - only = ["install.subdir", "backup_restore", "upgrade" ] - args.database = "mysql" From 91c8a6764c67f5b2c6285489b3bc896dcbf8dd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 20:01:32 +0100 Subject: [PATCH 2/6] fix --- conf/{config.inc.php.postgresql => config.inc.php} | 0 scripts/install | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename conf/{config.inc.php.postgresql => config.inc.php} (100%) diff --git a/conf/config.inc.php.postgresql b/conf/config.inc.php similarity index 100% rename from conf/config.inc.php.postgresql rename to conf/config.inc.php diff --git a/scripts/install b/scripts/install index 832147c..5825bed 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="config.inc.php.$database" --destination="$install_dir/galette/config/config.inc.php" +ynh_add_config --template="config.inc.php" --destination="$install_dir/galette/config/config.inc.php" chmod 400 "$install_dir/galette/config/config.inc.php" chown $app:$app "$install_dir/galette/config/config.inc.php" From 9f237598d02583ac2fe311e3ca244cf846812747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 20:02:44 +0100 Subject: [PATCH 3/6] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index b723e4d..9717d83 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Galette" description.en = "Membership management web application for non profit organizations" description.fr = "Outil de gestion d'adhérents et de cotisation en ligne pour associations" -version = "1.0.0~ynh1" +version = "1.0.0~ynh2" maintainers = [] From 372b08f0368790bdd038fb078ee503664c9e3f37 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 16 Nov 2023 19:02:50 +0000 Subject: [PATCH 4/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94ab480..cad85ce 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Galette is a membership management web application towards non profit organizati - Plugin support -**Shipped version:** 1.0.0~ynh1 +**Shipped version:** 1.0.0~ynh2 **Demo:** https://demo.galette.eu/login diff --git a/README_fr.md b/README_fr.md index 6c28c77..c5ed26c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -31,7 +31,7 @@ Outil de gestion d'adhérents et de cotisation en ligne pour associations. - Support de plugins -**Version incluse :** 1.0.0~ynh1 +**Version incluse :** 1.0.0~ynh2 **Démo :** https://demo.galette.eu/login From e6bfd10a864d82fa6b9de5aa6ff9cbde801f6556 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 20:21:23 +0100 Subject: [PATCH 5/6] Update doc/PRE_UPGRADE.md Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> --- doc/PRE_UPGRADE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/PRE_UPGRADE.md b/doc/PRE_UPGRADE.md index 42026a9..73ffa56 100644 --- a/doc/PRE_UPGRADE.md +++ b/doc/PRE_UPGRADE.md @@ -1 +1,3 @@ -if you were using a mysql DB, the new version only supports postgres and you should migrate it manually before upgrading. \ No newline at end of file +If you were using a mysql DB, the new version only supports postgres and you should migrate it manually before upgrading. + +NB: DO NOT confirm the upgrade without making sure first that you are using a postgresql database. \ No newline at end of file From 43b1b99f3a7eb9d89017c96df1cb61527920616e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 2 Dec 2023 23:28:02 +0100 Subject: [PATCH 6/6] Update PRE_UPGRADE.md --- doc/PRE_UPGRADE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/PRE_UPGRADE.md b/doc/PRE_UPGRADE.md index 73ffa56..a9717e7 100644 --- a/doc/PRE_UPGRADE.md +++ b/doc/PRE_UPGRADE.md @@ -1,3 +1,3 @@ -If you were using a mysql DB, the new version only supports postgres and you should migrate it manually before upgrading. +If you were using a MySQL DB, the new version only supports postgres and you should migrate it manually before upgrading. NB: DO NOT confirm the upgrade without making sure first that you are using a postgresql database. \ No newline at end of file