mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge pull request #496 from YunoHost-Apps/Enabling-MySQL-4-byte
Enable-MySQL-4-byte
This commit is contained in:
commit
3ead4efba5
3 changed files with 15 additions and 3 deletions
|
@ -19,6 +19,7 @@ ynh_mysql_dump_db() {
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
default_character_set="${default_character_set:-}"
|
default_character_set="${default_character_set:-}"
|
||||||
|
MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql
|
||||||
|
|
||||||
if [ -n "$default_character_set" ]
|
if [ -n "$default_character_set" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -65,10 +65,11 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_script_progression --message="Creating a MySQL database..." --weight=2
|
ynh_script_progression --message="Creating a MySQL database..." --weight=2
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \
|
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
|
||||||
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -175,6 +176,9 @@ exec_occ maintenance:install \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Nextcloud..." --weight=8
|
ynh_script_progression --message="Configuring Nextcloud..." --weight=8
|
||||||
|
|
||||||
|
# Set the mysql.utf8mb4 config to true in config.php
|
||||||
|
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"
|
||||||
|
|
||||||
# Ensure that UpdateNotification app is disabled
|
# Ensure that UpdateNotification app is disabled
|
||||||
exec_occ app:disable updatenotification
|
exec_occ app:disable updatenotification
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
user_home=$(ynh_app_setting_get --app=$app --key=user_home)
|
user_home=$(ynh_app_setting_get --app=$app --key=user_home)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
@ -246,7 +247,13 @@ then
|
||||||
exec_occ -V
|
exec_occ -V
|
||||||
|
|
||||||
if [ "$(exec_occ config:system:get mysql.utf8mb4)" != "true" ]; then
|
if [ "$(exec_occ config:system:get mysql.utf8mb4)" != "true" ]; then
|
||||||
exec_occ db:convert-mysql-charset
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
# Change your databases character set and collation
|
||||||
|
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
|
||||||
|
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||||
|
# Set the mysql.utf8mb4 config to true in config.php
|
||||||
|
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"
|
||||||
|
exec_occ maintenance:repair
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Upgrade may fail if this app is enabled
|
# Upgrade may fail if this app is enabled
|
||||||
|
|
Loading…
Add table
Reference in a new issue