From 9f9564ef41273a242e678b69e856fd601f8b2b11 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 27 Feb 2021 21:18:39 +0100 Subject: [PATCH] ynh_add_config --- scripts/change_url | 9 ++------- scripts/install | 16 +++------------- scripts/upgrade | 7 +------ 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index c8bbf59..8b5c115 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -96,6 +96,7 @@ then mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + domain="$new_domain" fi #================================================= @@ -105,13 +106,7 @@ fi #================================================= ynh_script_progression --message="Updating Drush alias..." -drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" -cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" - -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$drush_aliasconfig" +ynh_add_config --template="../conf/yoursite.aliases.drushrc.php" --destination="$final_path/.drush/$app.aliases.drushrc.php" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 1b37071..ed689eb 100644 --- a/scripts/install +++ b/scripts/install @@ -118,13 +118,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Creating Drush alias..." mkdir -p "$final_path/.drush" -drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" -cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$drush_aliasconfig" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$drush_aliasconfig" +ynh_add_config --template="../conf/yoursite.aliases.drushrc.php" --destination="$final_path/.drush/$app.aliases.drushrc.php" #================================================= # INSTALL COMPOSER @@ -133,9 +128,7 @@ ynh_script_progression --message="Installing Composer..." mkdir -p "$final_path/.composer" -cp -f "../conf/composer.json" "$final_path/.composer/composer.json" - -ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer" +ynh_add_config --template="../conf/composer.json" --destination="$final_path/.composer/composer.json" export PATH="$final_path/.composer/vendor/bin:$PATH" @@ -173,10 +166,7 @@ update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} #================================================= ynh_script_progression --message="Setuping the cron file..." -cp ../conf/cron /etc/cron.d/$app - -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/upgrade b/scripts/upgrade index 97b2e36..d400919 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,12 +134,7 @@ ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php" #================================================= ynh_script_progression --message="Setuping the cron file" -cp -f ../conf/cron /etc/cron.d/$app - -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" - -ynh_systemd_action --service_name=cron --action=reload +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" #================================================= # GENERIC FINALIZATION