mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge 85d5ed1284
into 6aa9d05372
This commit is contained in:
commit
439b993130
1 changed files with 17 additions and 6 deletions
|
@ -14,16 +14,25 @@
|
||||||
# Requires YunoHost version 2.2.4 or higher.
|
# Requires YunoHost version 2.2.4 or higher.
|
||||||
ynh_mysql_connect_as() {
|
ynh_mysql_connect_as() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=upd
|
local legacy_args=updc
|
||||||
local -A args_array=([u]=user= [p]=password= [d]=database=)
|
local -A args_array=( [u]=user= [p]=password= [d]=database= [c]=default_character_set= )
|
||||||
local user
|
local user
|
||||||
local password
|
local password
|
||||||
local database
|
local database
|
||||||
|
local default_character_set
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
database="${database:-}"
|
database="${database:-}"
|
||||||
|
default_character_set="${default_character_set:-}"
|
||||||
|
|
||||||
mysql --user="$user" --password="$password" --batch "$database"
|
if [ -n "$default_character_set" ]
|
||||||
|
then
|
||||||
|
default_character_set="--default-character-set=$default_character_set"
|
||||||
|
else
|
||||||
|
default_character_set="--default-character-set=latin1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mysql --user="$user" --password="$password" "$default_character_set" --batch "$database"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute a command as root user
|
# Execute a command as root user
|
||||||
|
@ -127,13 +136,15 @@ ynh_mysql_drop_db() {
|
||||||
# Requires YunoHost version 2.2.4 or higher.
|
# Requires YunoHost version 2.2.4 or higher.
|
||||||
ynh_mysql_dump_db() {
|
ynh_mysql_dump_db() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=d
|
local legacy_args=dc
|
||||||
local -A args_array=([d]=database=)
|
local -A args_array=( [d]=database= [c]=default_character_set= )
|
||||||
local database
|
local database
|
||||||
|
local default_character_set
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
default_character_set="${default_character_set:-latin1}"
|
||||||
|
|
||||||
mysqldump --single-transaction --skip-dump-date --routines "$database"
|
mysqldump --single-transaction --skip-dump-date --routines --default-character-set=$default_character_set "$database"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a user
|
# Create a user
|
||||||
|
|
Loading…
Add table
Reference in a new issue