From 74bb96a4c4cf4e798f8c2817bdca15d075c124fe Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Wed, 26 Jul 2017 03:15:01 +0200 Subject: [PATCH] change all dbs (#320) --- nextcloud_install_production.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index d5673b84..bbf58394 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -262,21 +262,23 @@ sudo -u www-data php "$NCPATH"/occ status sleep 3 echo -# shellcheck disable=2034,2059 -true -# shellcheck source=lib.sh -NCDB=1 && MYCNFPW=1 . <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh) -unset NCDB -unset MYCNFPW - # Enable UTF8mb4 (4-byte support) -echo "Enabling UTF8mb4 support on $NCCONFIGDB...." -RESULT="$(mysqlshow --user=root --password="$MARIADB_PASS" "$NCCONFIGDB" | grep -v Wildcard | grep -o "$NCCONFIGDB")" -if [ "$RESULT" == "$NCCONFIGDB" ] +databases=$(mysql -u root -p"$MARIADB_PASS" -e "SHOW DATABASES;" | tr -d "| " | grep -v Database) +for db in $databases; do + if [[ "$db" != "performance_schema" ]] && [[ "$db" != _* ]] && [[ "$db" != "information_schema" ]]; + then + echo "Changing to UTF8mb4 on: $db" + mysql -u root -p"$MARIADB_PASS" -e "ALTER DATABASE $db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" + fi +done +if [ $? -ne 0 ] then - check_command "mysql -u root -e 'ALTER DATABASE $NCCONFIGDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;'" - wait -fi + echo "UTF8mb4 was not set. Something is wrong." + echo "Please report this bug to $ISSUES. Thank you!" + exit 1 + +# Repair and set Nextcloud config values +mysqlcheck -u root -p"$MARIADB_PASS" --auto-repair --optimize --all-databases check_command sudo -u www-data $NCPATH/occ config:system:set mysql.utf8mb4 --type boolean --value="true" check_command sudo -u www-data $NCPATH/occ maintenance:repair