1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/prestashop_ynh.git synced 2024-09-03 20:06:39 +02:00

Ajouter la fonction GENERATE_DB

This commit is contained in:
magikcypress 2017-03-16 14:38:19 +01:00
parent 25f7570cda
commit dd78dad684

View file

@ -59,6 +59,21 @@ ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null
eval "$@" > /dev/null 2>&1
}
#=================================================
# Create a database and a dedicated user in the name of the app
#=================================================
GENERATE_DB () {
# $1 = Database name
# Generates a random password.
db_user=$1
db_pwd=$(head -n20 /dev/urandom | tr -c -d 'A-Za-z0-9' | head -c20)
CHECK_VAR "$db_pwd" "db_pwd empty"
# Uses '$ app' as user name and database
# Initializes the database and stores the mysql password.
ynh_mysql_create_db "$db_user" "$db_user" $db_pwd
ynh_app_setting_set $app mysqlpwd $db_pwd
}
#=================================================
# SETUP
#=================================================