Skip to content

Commit

Permalink
Merge pull request #2689 from Varying-Vagrant-Vagrants/phpwarnings-ip…
Browse files Browse the repository at this point in the history
…6-vm-hosts

Better PHP warnings and IP6 VM hostfiles
  • Loading branch information
tomjn authored Oct 16, 2023
2 parents 399ba36 + 7af0618 commit ac78a24
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ permalink: /docs/en-US/changelog/
* Switched the default PHP to v8.0 ( #2658 )
* WP Coding standards v3 ( #2688 )
* VIP Coding standards v3 ( #2688 )
* Better error messages with links to docs when trying to use a PHP version that isn't installed ( #2689 )
* Opted out of Dotnet package telemetry ( #2689 )

### Bug Fixes

* The host file inside the VM was only adding sites with `127.0.0.1` addresses, now it adds the IPVv6 `::1` too ( #2689 )

## 3.12 ( 2023 August 3rd )

Expand Down
3 changes: 3 additions & 0 deletions provision/core/env/homedir/.bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if [ -n "$BASH_VERSION" ]; then
fi
fi

# Telemetry opt outs
export DOTNET_CLI_TELEMETRY_OPTOUT=1

export PATH="$PATH:/srv/www/phpcs/bin"

# set variable identifying the chroot you work in (used in the prompt below)
Expand Down
10 changes: 8 additions & 2 deletions provision/provision-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ vvv_validate_site_php_version() {
vvv_warn " ! Warning: PHP version defined is using a wrong format: '${SITE_PHP}' with length '${#SITE_PHP}'"
vvv_warn " If you are trying to use a more specific version of PHP such as 7.4.1 or 7.4.0 you"
vvv_warn " need to be less specific and use 7.4"
vvv_warn " ! https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/"
fi

if [[ ! -e "/usr/bin/php${SITE_PHP}" ]]; then
vvv_warn " ! Warning: Chosen PHP version doesn't exist in this environment: '${SITE_PHP}' looking for '/usr/bin/php${SITE_PHP}'"
vvv_warn " ! Warning: The chosen PHP version doesn't exist in this environment: '${SITE_PHP}' looking for '/usr/bin/php${SITE_PHP}'"
vvv_warn " ! Did you forget to install it via config/config.yml? Add it to the extensions section as documented in the"
vvv_warn " ! changing PHP versions age on the VVV site, and re-provision:"
vvv_warn " ! https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/"
fi
}

Expand Down Expand Up @@ -228,7 +232,8 @@ function vvv_provision_hosts_file() {
while IFS='' read -r line || [ -n "${line}" ]; do
if [[ "#" != "${line:0:1}" ]]; then
if [[ -z "$(grep -q "^127.0.0.1 ${line}$" /etc/hosts)" ]]; then
echo "127.0.0.1 $line # vvv-auto" >> "/etc/hosts"
echo "127.0.0.1 ${line} # vvv-auto" >> "/etc/hosts"
echo "::1 ${line} # vvv-auto" >> "/etc/hosts"
echo " - Added ${line} from ${HOSTFILE}"
fi
fi
Expand Down Expand Up @@ -273,6 +278,7 @@ function vvv_process_site_hosts() {
for line in $hosts; do
if [[ -z "$(grep -q "^127.0.0.1 ${line}$" /etc/hosts)" ]]; then
echo "127.0.0.1 ${line} # vvv-auto" >> "/etc/hosts"
echo "::1 ${line} # vvv-auto" >> "/etc/hosts"
echo " - Added ${line} from ${VVV_CONFIG}"
fi
done
Expand Down

0 comments on commit ac78a24

Please sign in to comment.