Skip to content

Commit

Permalink
Set all flags to true by default, disable on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Mar 14, 2019
1 parent fdff014 commit 45b7fdf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions 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"
Expand Down
9 changes: 6 additions & 3 deletions bin/install-wordpress.sh
Expand Up @@ -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...")
Expand Down

0 comments on commit 45b7fdf

Please sign in to comment.