mirror of
https://github.com/YunoHost-Apps/grav_ynh.git
synced 2024-09-03 19:16:01 +02:00
Refactoriser remove
This commit is contained in:
parent
b5c5bc1a35
commit
f1b74ff30d
1 changed files with 22 additions and 13 deletions
|
@ -3,22 +3,31 @@
|
||||||
# Exit on command errors and treat unset variables as an error
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
source .fonctions # Loads the generic functions usually used in the script
|
# Get multi-instances specific variables
|
||||||
source /usr/share/yunohost/helpers # Source app helpers
|
|
||||||
|
|
||||||
# Retrieves application info.
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
|
|
||||||
REMOVE_BDD $app # Deleting the database and the associated user.
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
SECURE_REMOVE '/var/www/$app' # Removing the application folder
|
# Retrieve app settings
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
|
||||||
|
|
||||||
REMOVE_NGINX_CONF # Deleting the nginx configuration
|
# Drop MySQL database and user as needed
|
||||||
|
if [[ $with_mysql -eq 1 ]]; then
|
||||||
|
dbname=$app
|
||||||
|
dbuser=$app
|
||||||
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
ynh_mysql_drop_db $dbname || true
|
||||||
|
ynh_mysql_drop_user $dbuser || true
|
||||||
|
fi
|
||||||
|
|
||||||
REMOVE_FPM_CONF # Deleting the php-fpm pool configuration
|
# Delete app directory and configurations
|
||||||
|
sudo rm -rf "/var/www/${app}"
|
||||||
|
sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf"
|
||||||
|
sudo rm -f "/etc/php5/fpm/conf.d/20-${app}.ini"
|
||||||
|
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
|
||||||
# Reload SSOwat configuration
|
# Reload services
|
||||||
sudo yunohost app ssowatconf
|
sudo service php5-fpm restart || true
|
||||||
|
sudo service nginx reload || true
|
||||||
echo -e "\e[0m" # Restore normal color
|
|
Loading…
Add table
Reference in a new issue