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 PHP when testing in CircleCI.
  • Loading branch information
timnolte committed Jul 26, 2022
1 parent e825bc9 commit a9bead9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
- restore_cache:
keys:
- test-lint-dependencies-{{ checksum "composer.json" }}
- run:
name: "Increate PHP memory limit"
command: |
echo 'memory_limit = -1' | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini
- run: composer install -n --prefer-dist
- save_cache:
key: test-lint-dependencies-{{ checksum "composer.json" }}
Expand All @@ -46,6 +50,10 @@ jobs:
- restore_cache:
keys:
- test-behat-dependencies-{{ checksum "composer.json" }}
- run:
name: "Increate PHP memory limit"
command: |
echo 'memory_limit = -1' | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini
- run: composer install -n --prefer-dist
- save_cache:
key: test-behat-dependencies-{{ checksum "composer.json" }}
Expand Down Expand Up @@ -94,6 +102,10 @@ jobs:
- restore_cache:
keys:
- test-phpunit-dependencies-{{ checksum "composer.json" }}
- run:
name: "Increate PHP memory limit"
command: |
echo 'memory_limit = -1' | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-dependencies-{{ checksum "composer.json" }}
Expand Down Expand Up @@ -133,6 +145,10 @@ jobs:
- restore_cache:
keys:
- test-phpunit-dependencies-{{ checksum "composer.json" }}
- run:
name: "Increate PHP memory limit"
command: |
echo 'memory_limit = -1' | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-dependencies-{{ checksum "composer.json" }}
Expand Down
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 a9bead9

Please sign in to comment.