1
0
Fork 0
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:
Éric Gaspar 2022-08-06 18:08:08 +02:00 committed by GitHub
commit 3ead4efba5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View file

@ -19,6 +19,7 @@ ynh_mysql_dump_db() {
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
default_character_set="${default_character_set:-}"
MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql
if [ -n "$default_character_set" ]
then

View file

@ -65,10 +65,11 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Creating a MySQL database..." --weight=2
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_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;"
#=================================================
@ -175,6 +176,9 @@ exec_occ maintenance:install \
#=================================================
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
exec_occ app:disable updatenotification

View file

@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -246,7 +247,13 @@ then
exec_occ -V
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
# Upgrade may fail if this app is enabled