From 5bb2832d528dd04d54748a7aa7e6e37621841935 Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Fri, 6 Feb 2015 16:19:21 -0500 Subject: [PATCH] prevent redundant messages when loading HHVM configs prepare_hhvm_ini is called twice, and the second time around, some of the variables already exist, so it'll print messages that are redundant because the variable values are not user supplied and we're not in verbose mode --- bin/heroku-hhvm-apache2 | 10 +++++----- bin/heroku-hhvm-nginx | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/heroku-hhvm-apache2 b/bin/heroku-hhvm-apache2 index cc43c991f..97390a450 100755 --- a/bin/heroku-hhvm-apache2 +++ b/bin/heroku-hhvm-apache2 @@ -219,14 +219,14 @@ if [[ "$#" == "1" ]]; then fi fi -function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support -if [[ -n ${php_config:-} || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose ) ]]; then +function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support; if a value for $1 is passed then it won't echo messages upon second invocation +if [[ ( -n ${php_config:-} && ! ${1:-} ) || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose && ! ${1:-} ) ]]; then echo "Using HHVM configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 fi php_configs=( "-c" "$(php_passthrough "$php_config")" ) if [[ -n ${hhvm_config_extra:-} ]]; then - echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 + [[ ${1:-} ]] || echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 php_configs+=( "-c" "$(php_passthrough "$hhvm_config_extra")" ) fi } @@ -273,8 +273,8 @@ else echo "Running ${WEB_CONCURRENCY} threads as per \$WEB_CONCURRENCY" >&2 fi -# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated -prepare_hhvm_ini +# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated; we pass an argument to it to avoid it echoing "using HHVM config ..." messages again because that already happened +prepare_hhvm_ini no_messages # make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below # this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter). diff --git a/bin/heroku-hhvm-nginx b/bin/heroku-hhvm-nginx index d4cb1255f..79cd4ce58 100755 --- a/bin/heroku-hhvm-nginx +++ b/bin/heroku-hhvm-nginx @@ -219,14 +219,14 @@ if [[ "$#" == "1" ]]; then fi fi -function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support -if [[ -n ${php_config:-} || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose ) ]]; then +function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support; if a value for $1 is passed then it won't echo messages upon second invocation +if [[ ( -n ${php_config:-} && ! ${1:-} ) || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose && ! ${1:-} ) ]]; then echo "Using HHVM configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 fi php_configs=( "-c" "$(php_passthrough "$php_config")" ) if [[ -n ${hhvm_config_extra:-} ]]; then - echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 + [[ ${1:-} ]] || echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 php_configs+=( "-c" "$(php_passthrough "$hhvm_config_extra")" ) fi } @@ -273,8 +273,8 @@ else echo "Running ${WEB_CONCURRENCY} threads as per \$WEB_CONCURRENCY" >&2 fi -# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated -prepare_hhvm_ini +# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated; we pass an argument to it to avoid it echoing "using HHVM config ..." messages again because that already happened +prepare_hhvm_ini no_messages # make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below # this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter).