From 322dc169e62c7882f8d26dde55d03da8fa139a71 Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 11 Nov 2019 23:19:47 +0100 Subject: [PATCH] [PHP-FPM] Check if tz data import is necessary --- data/Dockerfiles/phpfpm/docker-entrypoint.sh | 9 ++++++--- docker-compose.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/data/Dockerfiles/phpfpm/docker-entrypoint.sh b/data/Dockerfiles/phpfpm/docker-entrypoint.sh index 9c686518..49e2e3db 100755 --- a/data/Dockerfiles/phpfpm/docker-entrypoint.sh +++ b/data/Dockerfiles/phpfpm/docker-entrypoint.sh @@ -76,9 +76,12 @@ if [ ${SQL_CHANGED} -eq 1 ]; then fi # Check mysql tz import -SQL_FULL_TZINFO_IMPORT_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_tzinfo_to_sql"}' --silent -H 'Content-type: application/json') -echo "MySQL mysql_tzinfo_to_sql - debug output:" -echo ${SQL_FULL_TZINFO_IMPORT_RETURN} +TZ_CHECK=$(mysql --socket=/var/run/mysqld/mysqld.sock -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT CONVERT_TZ('2019-11-02 23:33:00','Europe/Berlin','UTC') AS time;" -BN 2> /dev/null) +if [[ -z ${TZ_CHECK} ]]; then + SQL_FULL_TZINFO_IMPORT_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_tzinfo_to_sql"}' --silent -H 'Content-type: application/json') + echo "MySQL mysql_tzinfo_to_sql - debug output:" + echo ${SQL_FULL_TZINFO_IMPORT_RETURN} +fi # Trigger db init echo "Running DB init..." diff --git a/docker-compose.yml b/docker-compose.yml index 2d306846..51e55a83 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -97,7 +97,7 @@ services: - rspamd php-fpm-mailcow: - image: mailcow/phpfpm:1.53 + image: mailcow/phpfpm:1.54 build: ./data/Dockerfiles/phpfpm command: "php-fpm -d date.timezone=${TZ} -d expose_php=0" depends_on: