mirror of
https://github.com/YunoHost-Apps/joomla_ynh.git
synced 2024-09-03 19:26:34 +02:00
Backup config file before upgrade and restore it
This commit is contained in:
parent
ba1e9a0b98
commit
6e55e9cac0
1 changed files with 18 additions and 3 deletions
|
@ -47,6 +47,17 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# BACKUP CONFIGURATION FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up configuration file..."
|
||||
|
||||
# Create a temporary directory
|
||||
tmpdir="$(ynh_smart_mktemp min_size=3)"
|
||||
|
||||
# Backup the config file in the temp dir
|
||||
cp -a "$final_path/configuration.php" "$tmpdir/configuration.php"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -116,11 +127,15 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
# RESTORE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
ynh_script_progression --message="Restoring configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/configuration.php" --destination="$final_path/configuration.php"
|
||||
#ynh_add_config --template="../conf/configuration.php" --destination="$final_path/configuration.php"
|
||||
|
||||
# Restore config file
|
||||
mv -f "$tmpdir/configuration.php" "$final_path/configuration.php"
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
chmod 400 "$final_path/configuration.php"
|
||||
chown $app:$app "$final_path/configuration.php"
|
||||
|
|
Loading…
Add table
Reference in a new issue