From a14ab1e9f5feb0ea8a665656337d116d3eb80cd7 Mon Sep 17 00:00:00 2001 From: farvardin Date: Wed, 7 Feb 2024 15:29:53 +0100 Subject: [PATCH] trying to keep already installed config --- scripts/upgrade | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ee82cfa..58dd47e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,7 +51,8 @@ ynh_app_setting_set --app="$app" --key=color --value="$color" ynh_script_progression --message="Upgrading source files..." --weight=3 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config.php pheditor.php menu.php config.t2t var/pages/main.txt var/pages/todo.txt var/pages/sandbox.txt var/pages/links.txt var/pages/admin.txt" +# ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config.php pheditor.php menu.php config.t2t var/pages/main.txt var/pages/todo.txt var/pages/sandbox.txt var/pages/links.txt var/pages/admin.txt" +ynh_setup_source --dest_dir="$install_dir" --keep="config.php pheditor.php menu.php config.t2t var/pages/main.txt var/pages/todo.txt var/pages/sandbox.txt var/pages/links.txt var/pages/admin.txt" chmod -R o-rwx "$install_dir" @@ -73,8 +74,21 @@ ynh_backup_if_checksum_is_different --file="$install_dir/pheditor.php" ynh_delete_file_checksum --file="$install_dir/config.php" ynh_delete_file_checksum --file="$install_dir/pheditor.php" -ynh_add_config --template="config.php" --destination="$install_dir/config.php" -ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php" +# Do not overwrite existing configuration as it could have user customization's and settings. +# Create file if it does not exist +if [ ! -f "$install_dir/config.php" ]; then + # Set the default settings + ynh_add_config --template="../conf/config.php" --destination="$install_dir/config.php" +fi + +if [ ! -f "$install_dir/pheditor.php" ]; then + # Set the default settings + ynh_add_config --template="../conf/pheditor.php" --destination="$install_dir/pheditor.php" +fi + + +# ynh_add_config --template="config.php" --destination="$install_dir/config.php" +# ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php" mkdir -p "$install_dir/templates/minimaxing/" ynh_delete_file_checksum --file="$install_dir/templates/minimaxing/minimaxing.less"