From ea387bf9e8923bef5601a91c67808190b68ca164 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 26 May 2018 13:32:59 +0200 Subject: [PATCH 1/2] Bugfixings - `.bin/friendica` copy bug - `.config/htconfig.php` was not well prepared for MariaDB --- .bin/friendica | 17 ++++++----------- .config/htconfig.php | 10 ++++++++-- 2018.05-rc/apache/bin/friendica | 17 ++++++----------- 2018.05-rc/apache/config/htconfig.php | 8 ++++++-- 2018.05-rc/fpm-alpine/bin/friendica | 17 ++++++----------- 2018.05-rc/fpm-alpine/config/htconfig.php | 8 ++++++-- 2018.05-rc/fpm/bin/friendica | 17 ++++++----------- 2018.05-rc/fpm/config/htconfig.php | 8 ++++++-- 8 files changed, 50 insertions(+), 52 deletions(-) diff --git a/.bin/friendica b/.bin/friendica index 07364eb..f931605 100644 --- a/.bin/friendica +++ b/.bin/friendica @@ -8,9 +8,6 @@ AUTOINSTALL=${AUTOINSTALL:-false} SOURCEDIR=/usr/src WORKDIR=/var/www/html -# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces) -#IFS=\r\n - VERBOSE=1 for arg; do case "$arg" in @@ -168,9 +165,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && "$AUTOINSTALL" == "true"; then - run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php" - # TODO Pull Request for dba Change - run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php" + run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console "autoinstall -f .htconfig.php" # TODO Workaround because of a strange permission issue rm -fr ${WORKDIR}/view/smarty3/compiled @@ -213,10 +208,10 @@ if [ $# -eq 0 ]; then fi case "$1" in - install) shift; install "$@";; - update) shift; update "$@" ;; - console) shift; console "$@" ;; - composer) shift; composer "$@" ;; - sendmail) shift; sendmail "$@" ;; + install) shift; install $@;; + update) shift; update $@ ;; + console) shift; console $@ ;; + composer) shift; composer $@ ;; + sendmail) shift; sendmail $@ ;; *) friendica_help ;; esac diff --git a/.config/htconfig.php b/.config/htconfig.php index fb8180f..4f5565c 100644 --- a/.config/htconfig.php +++ b/.config/htconfig.php @@ -3,14 +3,20 @@ // Custom htconfig.php for Docker usage. // Uses a lot of environment variables +// Use environment variables for mysql if they are set beforehand + // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) && !empty(getenv('MYSQL_PORT')) - && !empty(getenv('MYSQL_USERNAME')) + && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER'))) && !empty(getenv('MYSQL_PASSWORD')) && !empty(getenv('MYSQL_DATABASE'))) { $db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT'); - $db_user = getenv('MYSQL_USERNAME'); + if (!empty(getenv('MYSQL_USERNAME'))) { + $db_user = getenv('MYSQL_USERNAME'); + } elseif (!empty(getenv('MYSQL_USER'))) { + $db_user = getenv('MYSQL_USER'); + } $db_pass = getenv('MYSQL_PASSWORD'); $db_data = getenv('MYSQL_DATABASE'); } diff --git a/2018.05-rc/apache/bin/friendica b/2018.05-rc/apache/bin/friendica index 07364eb..f931605 100644 --- a/2018.05-rc/apache/bin/friendica +++ b/2018.05-rc/apache/bin/friendica @@ -8,9 +8,6 @@ AUTOINSTALL=${AUTOINSTALL:-false} SOURCEDIR=/usr/src WORKDIR=/var/www/html -# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces) -#IFS=\r\n - VERBOSE=1 for arg; do case "$arg" in @@ -168,9 +165,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && "$AUTOINSTALL" == "true"; then - run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php" - # TODO Pull Request for dba Change - run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php" + run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console "autoinstall -f .htconfig.php" # TODO Workaround because of a strange permission issue rm -fr ${WORKDIR}/view/smarty3/compiled @@ -213,10 +208,10 @@ if [ $# -eq 0 ]; then fi case "$1" in - install) shift; install "$@";; - update) shift; update "$@" ;; - console) shift; console "$@" ;; - composer) shift; composer "$@" ;; - sendmail) shift; sendmail "$@" ;; + install) shift; install $@;; + update) shift; update $@ ;; + console) shift; console $@ ;; + composer) shift; composer $@ ;; + sendmail) shift; sendmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05-rc/apache/config/htconfig.php b/2018.05-rc/apache/config/htconfig.php index fb8180f..c94b94a 100644 --- a/2018.05-rc/apache/config/htconfig.php +++ b/2018.05-rc/apache/config/htconfig.php @@ -6,11 +6,15 @@ // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) && !empty(getenv('MYSQL_PORT')) - && !empty(getenv('MYSQL_USERNAME')) + && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER'))) && !empty(getenv('MYSQL_PASSWORD')) && !empty(getenv('MYSQL_DATABASE'))) { $db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT'); - $db_user = getenv('MYSQL_USERNAME'); + if (!empty(getenv('MYSQL_USERNAME'))) { + $db_user = getenv('MYSQL_USERNAME'); + } elseif (!empty(getenv('MYSQL_USER'))) { + $db_user = getenv('MYSQL_USER'); + } $db_pass = getenv('MYSQL_PASSWORD'); $db_data = getenv('MYSQL_DATABASE'); } diff --git a/2018.05-rc/fpm-alpine/bin/friendica b/2018.05-rc/fpm-alpine/bin/friendica index 07364eb..f931605 100644 --- a/2018.05-rc/fpm-alpine/bin/friendica +++ b/2018.05-rc/fpm-alpine/bin/friendica @@ -8,9 +8,6 @@ AUTOINSTALL=${AUTOINSTALL:-false} SOURCEDIR=/usr/src WORKDIR=/var/www/html -# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces) -#IFS=\r\n - VERBOSE=1 for arg; do case "$arg" in @@ -168,9 +165,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && "$AUTOINSTALL" == "true"; then - run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php" - # TODO Pull Request for dba Change - run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php" + run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console "autoinstall -f .htconfig.php" # TODO Workaround because of a strange permission issue rm -fr ${WORKDIR}/view/smarty3/compiled @@ -213,10 +208,10 @@ if [ $# -eq 0 ]; then fi case "$1" in - install) shift; install "$@";; - update) shift; update "$@" ;; - console) shift; console "$@" ;; - composer) shift; composer "$@" ;; - sendmail) shift; sendmail "$@" ;; + install) shift; install $@;; + update) shift; update $@ ;; + console) shift; console $@ ;; + composer) shift; composer $@ ;; + sendmail) shift; sendmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05-rc/fpm-alpine/config/htconfig.php b/2018.05-rc/fpm-alpine/config/htconfig.php index fb8180f..c94b94a 100644 --- a/2018.05-rc/fpm-alpine/config/htconfig.php +++ b/2018.05-rc/fpm-alpine/config/htconfig.php @@ -6,11 +6,15 @@ // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) && !empty(getenv('MYSQL_PORT')) - && !empty(getenv('MYSQL_USERNAME')) + && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER'))) && !empty(getenv('MYSQL_PASSWORD')) && !empty(getenv('MYSQL_DATABASE'))) { $db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT'); - $db_user = getenv('MYSQL_USERNAME'); + if (!empty(getenv('MYSQL_USERNAME'))) { + $db_user = getenv('MYSQL_USERNAME'); + } elseif (!empty(getenv('MYSQL_USER'))) { + $db_user = getenv('MYSQL_USER'); + } $db_pass = getenv('MYSQL_PASSWORD'); $db_data = getenv('MYSQL_DATABASE'); } diff --git a/2018.05-rc/fpm/bin/friendica b/2018.05-rc/fpm/bin/friendica index 07364eb..f931605 100644 --- a/2018.05-rc/fpm/bin/friendica +++ b/2018.05-rc/fpm/bin/friendica @@ -8,9 +8,6 @@ AUTOINSTALL=${AUTOINSTALL:-false} SOURCEDIR=/usr/src WORKDIR=/var/www/html -# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces) -#IFS=\r\n - VERBOSE=1 for arg; do case "$arg" in @@ -168,9 +165,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && "$AUTOINSTALL" == "true"; then - run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php" - # TODO Pull Request for dba Change - run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php" + run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console "autoinstall -f .htconfig.php" # TODO Workaround because of a strange permission issue rm -fr ${WORKDIR}/view/smarty3/compiled @@ -213,10 +208,10 @@ if [ $# -eq 0 ]; then fi case "$1" in - install) shift; install "$@";; - update) shift; update "$@" ;; - console) shift; console "$@" ;; - composer) shift; composer "$@" ;; - sendmail) shift; sendmail "$@" ;; + install) shift; install $@;; + update) shift; update $@ ;; + console) shift; console $@ ;; + composer) shift; composer $@ ;; + sendmail) shift; sendmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05-rc/fpm/config/htconfig.php b/2018.05-rc/fpm/config/htconfig.php index fb8180f..c94b94a 100644 --- a/2018.05-rc/fpm/config/htconfig.php +++ b/2018.05-rc/fpm/config/htconfig.php @@ -6,11 +6,15 @@ // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) && !empty(getenv('MYSQL_PORT')) - && !empty(getenv('MYSQL_USERNAME')) + && (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER'))) && !empty(getenv('MYSQL_PASSWORD')) && !empty(getenv('MYSQL_DATABASE'))) { $db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT'); - $db_user = getenv('MYSQL_USERNAME'); + if (!empty(getenv('MYSQL_USERNAME'))) { + $db_user = getenv('MYSQL_USERNAME'); + } elseif (!empty(getenv('MYSQL_USER'))) { + $db_user = getenv('MYSQL_USER'); + } $db_pass = getenv('MYSQL_PASSWORD'); $db_data = getenv('MYSQL_DATABASE'); } From 965ffeecd16ff459f28050dbd16727cb1f353e10 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 26 May 2018 13:41:12 +0200 Subject: [PATCH 2/2] forgot to update htconfig.php --- .config/htconfig.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/.config/htconfig.php b/.config/htconfig.php index 4f5565c..c94b94a 100644 --- a/.config/htconfig.php +++ b/.config/htconfig.php @@ -3,8 +3,6 @@ // Custom htconfig.php for Docker usage. // Uses a lot of environment variables -// Use environment variables for mysql if they are set beforehand - // Use environment variables for mysql if they are set beforehand if (!empty(getenv('MYSQL_HOST')) && !empty(getenv('MYSQL_PORT'))