diff --git a/.travis.yml b/.travis.yml index 7b87e251a2525..0365f5855e893 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ jobs: - ./bin/run-wp-unit-tests.sh - name: E2E tests (Admin with plugins) (1/2) - env: WP_VERSION=latest POPULAR_PLUGINS=true + env: WP_VERSION=latest SCRIPT_DEBUG=false POPULAR_PLUGINS=true install: - ./bin/setup-local-env.sh script: @@ -74,7 +74,7 @@ jobs: - npm run test-e2e -- --ci --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 2 == 0' < ~/.jest-e2e-tests ) - name: E2E tests (Admin with plugins) (2/2) - env: WP_VERSION=latest POPULAR_PLUGINS=true + env: WP_VERSION=latest SCRIPT_DEBUG=false POPULAR_PLUGINS=true install: - ./bin/setup-local-env.sh script: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da1c2c8e655dd..5cd10599b8087 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,10 +79,11 @@ Alternatively, you can use your own local WordPress environment and clone this r Next, open a terminal (or if on Windows, a command prompt) and navigate to the repository you cloned. Now type `npm install` to get the dependencies all set up. Then you can type `npm run dev` in your terminal or command prompt to keep the plugin building in the background as you work on it. -WordPress comes with specific [debug systems](https://codex.wordpress.org/Debugging_in_WordPress) designed to simplify the process as well as standardize code across core, plugins and themes. It is possible to use environment variables (`WP_DEBUG`, `WP_DEBUG_DISPLAY` and `SCRIPT_DEBUG`) to update a site's configuration constants located in `wp-config.php` file. They can be updated at any time by running the following command: +WordPress comes with specific [debug systems](https://codex.wordpress.org/Debugging_in_WordPress) designed to simplify the process as well as standardize code across core, plugins and themes. It is possible to use environment variables (`WP_DEBUG`, `WP_DEBUG_DISPLAY` and `SCRIPT_DEBUG`) to update a site's configuration constants located in `wp-config.php` file. Any of the flags can be disabled at any time by running the following command: ``` -SCRIPT_DEBUG=true WP_DEBUG=true WP_DEBUG_DISPLAY=true ./bin/setup-local-env.sh +SCRIPT_DEBUG=false WP_DEBUG=false WP_DEBUG_DISPLAY=false ./bin/setup-local-env.sh ``` +By default, all 3 flags will be set to `true`. ### On A Remote Server diff --git a/bin/bootstrap-env.sh b/bin/bootstrap-env.sh index 6b3b1c9d29aee..733b78557fe0e 100755 --- a/bin/bootstrap-env.sh +++ b/bin/bootstrap-env.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash WP_VERSION=${WP_VERSION-latest} +WP_DEBUG=${WP_DEBUG-true} +WP_DEBUG_DISPLAY=${WP_DEBUG_DISPLAY-true} +SCRIPT_DEBUG=${SCRIPT_DEBUG-true} DOCKER=${DOCKER-false} DOCKER_ENV=${DOCKER_ENV-ci} DOCKER_COMPOSE_FILE_OPTIONS="-f docker-compose.yml" diff --git a/bin/install-wordpress.sh b/bin/install-wordpress.sh index 77c2591fdb433..eaaf60672f069 100755 --- a/bin/install-wordpress.sh +++ b/bin/install-wordpress.sh @@ -92,17 +92,20 @@ fi # Configure site constants. echo -e $(status_message "Configuring site constants...") -if [ ! -z "$WP_DEBUG" ]; then +WP_DEBUG_CURRENT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json WP_DEBUG) +if [ $WP_DEBUG != $WP_DEBUG_CURRENT ]; then docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI config set WP_DEBUG $WP_DEBUG --raw --type=constant --quiet WP_DEBUG_RESULT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json WP_DEBUG) echo -e $(status_message "WP_DEBUG: $WP_DEBUG_RESULT...") fi -if [ ! -z "$WP_DEBUG_DISPLAY" ]; then +WP_DEBUG_DISPLAY_CURRENT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json WP_DEBUG_DISPLAY) +if [ $WP_DEBUG_DISPLAY != $WP_DEBUG_DISPLAY_CURRENT ]; then docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI config set WP_DEBUG_DISPLAY $WP_DEBUG_DISPLAY --raw --type=constant --quiet WP_DEBUG_DISPLAY_RESULT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json WP_DEBUG_DISPLAY) echo -e $(status_message "WP_DEBUG_DISPLAY: $WP_DEBUG_DISPLAY_RESULT...") fi -if [ ! -z "$SCRIPT_DEBUG" ]; then +SCRIPT_DEBUG_CURRENT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json SCRIPT_DEBUG) +if [ $SCRIPT_DEBUG != $SCRIPT_DEBUG_CURRENT ]; then docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI config set SCRIPT_DEBUG $SCRIPT_DEBUG --raw --type=constant --quiet SCRIPT_DEBUG_RESULT=$(docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run -T --rm -u 33 $CLI config get --type=constant --format=json SCRIPT_DEBUG) echo -e $(status_message "SCRIPT_DEBUG: $SCRIPT_DEBUG_RESULT...")