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"