Skip to content

Commit

Permalink
Fixes assumption that CACHE_PORT & CACHE_PASSWORD are Set.
Browse files Browse the repository at this point in the history
* Falls back on port 6379 if the CACHE_PORT is not configured.
* Doesn't require a CACHE_PASSWORD to be set when it isn't used, or can't be.
* Increase memory limit for PHPUnit when testing in CircleCI.
  • Loading branch information
timnolte committed Aug 3, 2022
1 parent e825bc9 commit 5eccb44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ jobs:
name: "Run Tests"
command: |
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
composer phpunit
WP_MULTISITE=1 composer phpunit
WP_REDIS_USE_CACHE_GROUPS=1 composer phpunit
composer phpunit -d memory_limit=4G
WP_MULTISITE=1 composer phpunit -d memory_limit=4G
WP_REDIS_USE_CACHE_GROUPS=1 composer phpunit -d memory_limit=4G
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 nightly true
composer phpunit
composer phpunit -d memory_limit=4G
test-phpunit-redis-enabled:
working_directory: ~/pantheon-systems/wp-redis
docker:
Expand Down Expand Up @@ -154,9 +154,9 @@ jobs:
name: "Run Tests"
command: |
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
composer phpunit
WP_MULTISITE=1 composer phpunit
WP_REDIS_USE_CACHE_GROUPS=1 composer phpunit
composer phpunit -d memory_limit=4G
WP_MULTISITE=1 composer phpunit -d memory_limit=4G
WP_REDIS_USE_CACHE_GROUPS=1 composer phpunit -d memory_limit=4G
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 nightly true
composer phpunit
composer phpunit -d memory_limit=4G
4 changes: 2 additions & 2 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,8 @@ public function build_client_parameters( $redis_server ) {
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379,
'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'] : null,
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions wp-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function wp_redis_get_info() {
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379,
'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'] : null,
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
Expand Down

0 comments on commit 5eccb44

Please sign in to comment.