diff --git a/scripts/remove b/scripts/remove index 4c6335b..8d8a78f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -11,16 +11,16 @@ app=$YNH_APP_INSTANCE_NAME # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) -with_mysql=$(ynh_app_setting_get "$app" with_mysql) +# with_mysql=$(ynh_app_setting_get "$app" with_mysql) # 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 +#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 # Delete app directory and configurations sudo rm -rf "/var/www/${app}" diff --git a/scripts/restore b/scripts/restore index 0f6132c..fe15365 100644 --- a/scripts/restore +++ b/scripts/restore @@ -4,7 +4,7 @@ # Exit on command errors and treat unset variables as an error set -eu -# The parameter $2 is the id of the app instance ex: ynhexample__2 +# The parameter $app is the id of the app instance ex: ynhexample__2 app=$YNH_APP_INSTANCE_NAME # Source app helpers @@ -46,7 +46,7 @@ fi sudo cp -a ./sources "$final_path" # Set permissions -sudo chown -R www-data: $final_path +sudo chown -R www-data: "$final_path" # Restore db # if [[ $with_mysql -eq 1 ]]; then @@ -55,8 +55,6 @@ db_user=$app ynh_mysql_create_db $db_user $db_user $db_pwd sudo su -c "mysql -u $db_user -p$db_pwd $app < ./db.sql" sudo rm -f "./db.sql" -# sudo sed -i -e "s/'__DB_USER__', *'[^']*'/'__DB_USER__', '$app'/g" $final_path/config/connect.php -# sudo sed -i -e "s/'__DB_PWD__', *'[^']*'/'__DB_PWD__', '$app'/g" $final_path/config/connect.php sudo sed -i "s@__DB_USER__@$db_user@g" $final_path/config/connect.php sudo sed -i "s@__DB_PWD__@$db_pwd@g" $final_path/config/connect.php # fi @@ -68,5 +66,7 @@ sudo cp -a ./php-fpm.conf "$phpfpm_conf" sudo cp -a ./php-fpm.ini "$phpfpm_ini" # Reload services -sudo service php5-fpm reload || true -sudo service nginx reload || true +sudo service nginx reload +sudo service php5-fpm reload +sudo yunohost app ssowatconf +