1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
This commit is contained in:
ericgaspar 2022-04-06 08:51:01 +02:00
parent 5dfddca7d1
commit 9ab4030a1e
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 16 additions and 15 deletions

View file

@ -56,20 +56,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP OF THE DATABASE
#=================================================
if [ $database -eq 1 ]; then
# Backup MySQL database
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
elif [ $database -eq 2 ]; then
# Backup PostgreSQL database
ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
@ -91,6 +77,20 @@ ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP OF THE DATABASE
#=================================================
if [ $database -eq 1 ]; then
# Backup MySQL database
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
elif [ $database -eq 2 ]; then
# Backup PostgreSQL database
ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -31,6 +31,7 @@ email=$(ynh_user_get_info --username=$admin --key=mail)
upload="256M" upload="256M"
random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)"
database=`expr $YNH_APP_ARG_DATABASE` database=`expr $YNH_APP_ARG_DATABASE`
phpversion=$YNH_PHP_VERSION
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -163,7 +164,7 @@ if [ $database -eq 1 ]; then
elif [ $database -eq 2 ]; then elif [ $database -eq 2 ]; then
# Create postgresql database # Create postgresql database
ynh_script_progression --message="Creating a PostgreSQL database..." ynh_script_progression --message="Creating a PostgreSQL database..."
ynh_replace_string --match_string="db_type = 0;" --replace_string="db_type = 1;" --target_file="$config" ynh_replace_string --match_string="db_type = 0;" --replace_string="db_type = 1;" --target_file="$final_path/.htconfig.php"
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
ynh_psql_test_if_first_run ynh_psql_test_if_first_run