1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

use ynh_secure_remove and ynh_replace_string

This commit is contained in:
Jean-Baptiste Holcroft 2017-10-25 14:30:00 +02:00
parent 0629397837
commit 133a66296f
3 changed files with 9 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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