diff --git a/scripts/backup b/scripts/backup index 8a35241..6f9007c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,8 +6,8 @@ set -eu app=$YNH_APP_INSTANCE_NAME # Set app specific variables -dbname=$app -dbuser=$app +dbname=`sudo cat /var/www/$app/config/config.php |grep dbname|sed "s|.*=> '\(.*\)'.*|\1|g"` +dbuser=$dbname # Source app helpers source /usr/share/yunohost/helpers diff --git a/scripts/remove b/scripts/remove index e7b807c..c5cf494 100755 --- a/scripts/remove +++ b/scripts/remove @@ -5,8 +5,8 @@ source ./_common.sh # Set app specific variables app=$APPNAME -dbname=$app -dbuser=$app +dbname=`sudo cat /var/www/$app/config/config.php |grep dbname|sed "s|.*=> '\(.*\)'.*|\1|g"` +dbuser=$dbname # Source app helpers source /usr/share/yunohost/helpers diff --git a/scripts/restore b/scripts/restore index e97c612..f71c6e4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -5,10 +5,6 @@ set -eu # Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME -# Set app specific variables -dbname=$app -dbuser=$app - # Source app helpers source /usr/share/yunohost/helpers @@ -54,6 +50,10 @@ sudo cp -a ./www "$DESTDIR" sudo mkdir -p "$DATADIR" sudo cp -a ./data/. "$DATADIR" +# Set app specific variables +dbname=`sudo cat /var/www/$app/config/config.php |grep dbname|sed "s|.*=> '\(.*\)'.*|\1|g"` +dbuser=$dbname + # Create and restore the database ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql diff --git a/scripts/upgrade b/scripts/upgrade index bed84c6..c494b1c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,8 +7,8 @@ source ./_common.sh # Set app specific variables app=$APPNAME -dbname=$app -dbuser=$app +dbname=`sudo cat /var/www/$app/config/config.php |grep dbname|sed "s|.*=> '\(.*\)'.*|\1|g"` +dbuser=$dbname # Source app helpers source /usr/share/yunohost/helpers