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:
parent
25f7570cda
commit
dd78dad684
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue