diff --git a/scripts/upgrade b/scripts/upgrade index c0b1a6b..6a971e1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,6 @@ fi chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -68,13 +67,26 @@ chmod 644 "/etc/cron.d/$app" #================================================= # SPECIFIC UPGRADE #================================================= +# add the newest config.local.php from older version +if ynh_compare_current_package_version --comparison lt --version 1.3.1~ynh1 +then + ynh_script_progression --message="Updating a configuration file..." --weight=5 + + ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php" + chmod 650 "$install_dir/config.local.php" + chown $app:$app "$install_dir/config.local.php" +fi # add config file if not present -if [ ! -f "$data_dir/data/config.local.user.php" ]; then - +if [ ! -d "$data_dir/data" ]; then ynh_script_progression --message="Adding a configuration file..." --weight=5 + mkdir "$data_dir/data" + chown $app:www-data "$data_dir/data" +fi + +if [ ! -f "$data_dir/data/config.local.user.php" ]; then + ynh_script_progression --message="Adding a configuration file..." --weight=5 - ynh_script_progression --message=" files..." --weight=5 ynh_add_config --template="config.local.user.php" --destination="$data_dir/data/config.local.user.php" chmod 650 "$data_dir/data/config.local.user.php" chown $app:$app "$data_dir/data/config.local.user.php"