#!/bin/bash

app=phpBB

db_user=$app
db_name=$app
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting $app domain)

# Remember to keep $root_pwd without a gap with -p otherwise it doesn't work
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
sudo rm -f /etc/php5/fpm/pool.d/$app.conf

sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app ssowatconf

