2016-07-26 22:51:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-06-28 17:29:32 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2015-03-07 15:30:01 +01:00
|
|
|
|
2016-06-28 17:29:32 +02:00
|
|
|
# Source app helpers
|
|
|
|
. /usr/share/yunohost/helpers
|
2015-02-01 20:20:54 +01:00
|
|
|
|
2016-06-28 17:29:32 +02:00
|
|
|
# Retrieve arguments
|
|
|
|
dbuser=$app
|
|
|
|
dbname=$app
|
|
|
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2015-02-01 20:20:54 +01:00
|
|
|
|
2016-06-28 17:29:32 +02:00
|
|
|
# Drop MySQL database and user
|
|
|
|
ynh_mysql_drop_db "$dbname" 2>&1 || true
|
|
|
|
ynh_mysql_drop_user "$dbuser" 2>&1 || true
|
2015-02-06 19:42:21 +01:00
|
|
|
|
2016-06-28 17:29:32 +02:00
|
|
|
# Delete app directory and configurations
|
|
|
|
sudo rm -rf "/var/www/${app}"
|
|
|
|
sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf"
|
|
|
|
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
|
|
|
|
|
|
# Reload services
|
|
|
|
sudo service php5-fpm restart || true
|
|
|
|
sudo service nginx reload || true
|