mirror of
https://github.com/YunoHost-Apps/wordpress_ynh.git
synced 2024-09-03 20:36:10 +02:00
46 lines
1.3 KiB
Bash
Executable file
46 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Récupère les infos de l'application.
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Source app helpers
|
|
. /usr/share/yunohost/helpers
|
|
domain=$(sudo yunohost app setting $app domain)
|
|
|
|
# Suppression de la base de donnée et de l'utilisateur associé.
|
|
# Utilise '$app' comme nom d'utilisateur et de base de donnée
|
|
db_user=$app
|
|
if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $db_user"; then
|
|
echo "Delete db"
|
|
ynh_mysql_drop_db $db_user
|
|
ynh_mysql_drop_user $db_user
|
|
fi
|
|
|
|
# Suppression du dossier de l'application
|
|
if [ -e "/var/www/$app" ]; then # Delete final_path
|
|
echo "Delete app dir"
|
|
sudo rm -r "/var/www/$app"
|
|
fi
|
|
|
|
# Suppression de la configuration nginx
|
|
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
|
|
echo "Delete nginx config"
|
|
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
sudo service nginx reload
|
|
fi
|
|
|
|
# Suppression de la configuration du pool php-fpm
|
|
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
|
|
echo "Delete fpm config"
|
|
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
|
|
fi
|
|
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
|
|
echo "Delete php config"
|
|
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
|
|
fi
|
|
sudo service php5-fpm reload
|
|
|
|
# Régénère la configuration de SSOwat
|
|
sudo yunohost app ssowatconf
|
|
|
|
echo -e "\e[0m" # Restore normal color
|