From 133a66296f3a16c8619b9d6872ece1facb0fe115 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Wed, 25 Oct 2017 14:30:00 +0200 Subject: [PATCH] use ynh_secure_remove and ynh_replace_string --- scripts/install | 8 ++++---- scripts/remove | 10 +++++----- scripts/upgrade | 3 --- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 3598a97..1d07fb6 100644 --- a/scripts/install +++ b/scripts/install @@ -89,7 +89,7 @@ init_composer "www-data" "$final_path" -u "www-data" php "$final_path/admin/migration.php" # Modify PHP-FPM pool configuration and copy it to the pool directory -sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf +ynh_replace_string "NAMETOCHANGE" "$app" ../conf/php-fpm.conf finalphpconf=/etc/php5/fpm/pool.d/$app.conf cp ../conf/php-fpm.conf $finalphpconf chown root: $finalphpconf @@ -107,9 +107,9 @@ ynh_package_install php-fpdf yunohost app addaccess $app -u $admin # Modify Nginx configuration file and copy it to Nginx conf directory -sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf -sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf -sed -i "s@YNH_APP_INSTANCE_NAME@$app@g" ../conf/nginx.conf +ynh_replace_string "PATHTOCHANGE" "$path" ../conf/nginx.conf +ynh_replace_string "ALIASTOCHANGE" "$final_path" ../conf/nginx.conf +ynh_replace_string "YNH_APP_INSTANCE_NAME" "$app" ../conf/nginx.conf cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # Reload Nginx and regenerate SSOwat conf service nginx reload diff --git a/scripts/remove b/scripts/remove index 357620a..85160e1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,14 +19,13 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) # Remove sources -rm -rf /var/www/$app +ynh_secure_remove "/var/www/$app" # Remove configuration files -rm -f /etc/nginx/conf.d/$domain.d/$app.conf +ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf -rm -f /etc/php5/fpm/pool.d/$app.conf -rm -f /etc/php5/fpm/conf.d/20-$app.ini -service php5-fpm reload +ynh_secure_remove /etc/php5/fpm/pool.d/$app.conf +ynh_secure_remove /etc/php5/fpm/conf.d/20-$app.ini # Drop MySQL database and user dbname=$app @@ -35,3 +34,4 @@ ynh_mysql_drop_db "$dbname" || true ynh_mysql_drop_user "$dbuser" || true service nginx reload +service php5-fpm reload diff --git a/scripts/upgrade b/scripts/upgrade index a30a84e..0291e69 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,9 +63,6 @@ dbuser=$app ### Execute potential SQL statements here # Copy files to the right place final_path=/var/www/$app -cp $final_path/admin/logs_studs.txt ../conf/ -rm -Rf $final_path -mkdir -p $final_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE