From d6f84d9eabe6c9b30ff507855e747ddd0d0c1bb2 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 30 May 2023 08:43:31 -0600 Subject: [PATCH 01/11] Connect via unix socket instead of filesystem to be compatible with php open_basedir restrictions. copied from #425 --- object-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-cache.php b/object-cache.php index d2f3ced..e15f02d 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1261,7 +1261,7 @@ public function build_client_parameters( $redis_server ) { } } - if ( file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. + if ( strpos($redis_server['host'], 'unix:///') === 0 ) ) { // Unix socket connection. // port must be null or socket won't connect. $port = null; } From 8e103caad4a6fe076adf56eefb54c777a8966ce6 Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Tue, 30 May 2023 08:45:17 -0600 Subject: [PATCH 02/11] Remove extra brace & fix spacing --- object-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object-cache.php b/object-cache.php index e15f02d..929d815 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1261,7 +1261,7 @@ public function build_client_parameters( $redis_server ) { } } - if ( strpos($redis_server['host'], 'unix:///') === 0 ) ) { // Unix socket connection. + if ( strpos( $redis_server['host'], 'unix:///' ) === 0 ) { // Unix socket connection. // port must be null or socket won't connect. $port = null; } From 4711c1f1c933218a95dee7b63c1e3b321d5aa798 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Mon, 5 Jun 2023 12:59:29 -0700 Subject: [PATCH 03/11] Updated changelog --- README.md | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 820297a..737c6d4 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a ## Changelog ## ### 1.4.3-dev ### +* Bug fix: Connect via unix socket instead of filesystem to be compatible with php open_basedir restrictions [[426](https://github.com/pantheon-systems/wp-redis/pull/426)] (props @hj-collab) * Bug fix: Fixes assumption that CACHE_PORT & CACHE_PASSWORD are Set. [[428](https://github.com/pantheon-systems/wp-redis/pull/428)] (props @timnolte) ### 1.4.2 (May 15, 2023) ### diff --git a/readme.txt b/readme.txt index 2779580..f2515fe 100644 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a == Changelog == = 1.4.3-dev = +* Bug fix: Connect via unix socket instead of filesystem to be compatible with php open_basedir restrictions [[426](https://github.com/pantheon-systems/wp-redis/pull/426)] (props @hj-collab) * Bug fix: Fixes assumption that CACHE_PORT & CACHE_PASSWORD are Set. [[428](https://github.com/pantheon-systems/wp-redis/pull/428)] (props @tnolte) = 1.4.2 (May 15, 2023) = From c3ef25efcee95123fbf2551ce27a17b5967d52f0 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Tue, 6 Jun 2023 13:09:45 -0400 Subject: [PATCH 04/11] Updates behat test. --- behat.yml | 1 + tests/behat/bootstrap/FeatureContext.php | 19 +++++++++++++++++++ tests/behat/load-wp.feature | 1 + 3 files changed, 21 insertions(+) create mode 100644 tests/behat/bootstrap/FeatureContext.php diff --git a/behat.yml b/behat.yml index ff5ce58..2776a21 100644 --- a/behat.yml +++ b/behat.yml @@ -7,6 +7,7 @@ default: contexts: - Behat\MinkExtension\Context\MinkContext - PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn + - FeatureContext extensions: Behat\MinkExtension: # base_url set by ENV diff --git a/tests/behat/bootstrap/FeatureContext.php b/tests/behat/bootstrap/FeatureContext.php new file mode 100644 index 0000000..4732ddb --- /dev/null +++ b/tests/behat/bootstrap/FeatureContext.php @@ -0,0 +1,19 @@ + Date: Tue, 6 Jun 2023 13:38:14 -0400 Subject: [PATCH 05/11] Adds constructor. --- tests/behat/bootstrap/FeatureContext.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/behat/bootstrap/FeatureContext.php b/tests/behat/bootstrap/FeatureContext.php index 4732ddb..5ddc8b6 100644 --- a/tests/behat/bootstrap/FeatureContext.php +++ b/tests/behat/bootstrap/FeatureContext.php @@ -4,6 +4,17 @@ class FeatureContext implements Context { + + /** + * Initializes context. + * + * Every scenario gets its own context instance. + * You can also pass arbitrary arguments to the + * context constructor through behat.yml. + */ + public function __construct() { + } + /** * Waits a certain number of seconds. * From 404b664c582d02705fd80dec682f3a76061d1ff6 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Tue, 6 Jun 2023 14:07:55 -0400 Subject: [PATCH 06/11] Adds constructor. --- behat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/behat.yml b/behat.yml index 2776a21..b0470f9 100644 --- a/behat.yml +++ b/behat.yml @@ -4,6 +4,7 @@ default: default: paths: - tests/behat + - tests/behat/bootstrap contexts: - Behat\MinkExtension\Context\MinkContext - PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn From e1fb0be2d82c494a0475aa600ed68cc57702fc5d Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Tue, 6 Jun 2023 15:49:08 -0400 Subject: [PATCH 07/11] Reorganizes files to match standards. --- behat.yml | 3 +-- tests/behat/{ => features}/bootstrap/FeatureContext.php | 8 ++++++-- tests/behat/{ => features}/load-wp.feature | 0 tests/behat/{ => features}/wp-redis.feature | 0 4 files changed, 7 insertions(+), 4 deletions(-) rename tests/behat/{ => features}/bootstrap/FeatureContext.php (80%) rename tests/behat/{ => features}/load-wp.feature (100%) rename tests/behat/{ => features}/wp-redis.feature (100%) diff --git a/behat.yml b/behat.yml index b0470f9..f54b57c 100644 --- a/behat.yml +++ b/behat.yml @@ -3,8 +3,7 @@ default: suites: default: paths: - - tests/behat - - tests/behat/bootstrap + - tests/behat/features contexts: - Behat\MinkExtension\Context\MinkContext - PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn diff --git a/tests/behat/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php similarity index 80% rename from tests/behat/bootstrap/FeatureContext.php rename to tests/behat/features/bootstrap/FeatureContext.php index 5ddc8b6..c9ff76e 100644 --- a/tests/behat/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -1,5 +1,7 @@ Date: Tue, 6 Jun 2023 16:27:58 -0400 Subject: [PATCH 08/11] Tests different context name --- behat.yml | 2 +- .../{FeatureContext.php => WPRedisFeatureContext.php} | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename tests/behat/features/bootstrap/{FeatureContext.php => WPRedisFeatureContext.php} (84%) diff --git a/behat.yml b/behat.yml index f54b57c..b4aba83 100644 --- a/behat.yml +++ b/behat.yml @@ -7,7 +7,7 @@ default: contexts: - Behat\MinkExtension\Context\MinkContext - PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn - - FeatureContext + - WPRedisFeatureContext extensions: Behat\MinkExtension: # base_url set by ENV diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/WPRedisFeatureContext.php similarity index 84% rename from tests/behat/features/bootstrap/FeatureContext.php rename to tests/behat/features/bootstrap/WPRedisFeatureContext.php index c9ff76e..f8cc848 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/WPRedisFeatureContext.php @@ -1,10 +1,11 @@ Date: Tue, 6 Jun 2023 17:16:24 -0400 Subject: [PATCH 09/11] Moves context --- behat.yml | 3 +-- .../{WPRedisFeatureContext.php => FeatureContext.php} | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) rename tests/behat/features/bootstrap/{WPRedisFeatureContext.php => FeatureContext.php} (92%) diff --git a/behat.yml b/behat.yml index b4aba83..d70c972 100644 --- a/behat.yml +++ b/behat.yml @@ -3,11 +3,10 @@ default: suites: default: paths: - - tests/behat/features + - tests/behat/ contexts: - Behat\MinkExtension\Context\MinkContext - PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn - - WPRedisFeatureContext extensions: Behat\MinkExtension: # base_url set by ENV diff --git a/tests/behat/features/bootstrap/WPRedisFeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php similarity index 92% rename from tests/behat/features/bootstrap/WPRedisFeatureContext.php rename to tests/behat/features/bootstrap/FeatureContext.php index f8cc848..285a54e 100644 --- a/tests/behat/features/bootstrap/WPRedisFeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -5,7 +5,7 @@ use Behat\Behat\Context\Context; -class WPRedisFeatureContext implements Context +class FeatureContext implements Context { /** From 45e884477560c0bede90b72b6d59cbf639ae44a3 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Tue, 6 Jun 2023 17:39:16 -0400 Subject: [PATCH 10/11] Moves context --- tests/behat/features/wp-redis.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/behat/features/wp-redis.feature b/tests/behat/features/wp-redis.feature index dec2f5f..3ba5d0b 100644 --- a/tests/behat/features/wp-redis.feature +++ b/tests/behat/features/wp-redis.feature @@ -15,4 +15,3 @@ Feature: WP Redis Then I should see "Redis Calls:" And I should see "Cache Hits:" And I should see "Cache Misses:" - And I should see "- get:" From 3a8287d3beeaf1865691074eeb6e1197133ea804 Mon Sep 17 00:00:00 2001 From: Ryan Wagner Date: Wed, 7 Jun 2023 14:20:19 -0400 Subject: [PATCH 11/11] Updates redis checks. --- tests/behat/features/wp-redis.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/behat/features/wp-redis.feature b/tests/behat/features/wp-redis.feature index 3ba5d0b..f089d79 100644 --- a/tests/behat/features/wp-redis.feature +++ b/tests/behat/features/wp-redis.feature @@ -15,3 +15,5 @@ Feature: WP Redis Then I should see "Redis Calls:" And I should see "Cache Hits:" And I should see "Cache Misses:" + And I should see "- redis_get:" + And I should see "- redis-get:"