From c796272bef4222ca982228d0d749528b621619d6 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Mon, 24 Feb 2020 10:37:48 -0800 Subject: [PATCH 1/3] Use `proc_open()` equivalent directly, instead of `WP_CLI::launch()` --- cli.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cli.php b/cli.php index 06c963a..55a6388 100644 --- a/cli.php +++ b/cli.php @@ -23,6 +23,7 @@ public function cli() { $redis_server = array( 'host' => '127.0.0.1', 'port' => 6379, + 'auth' => '', ); } } @@ -31,9 +32,10 @@ public function cli() { $redis_server['database'] = 0; } - $cmd = WP_CLI\Utils\esc_cmd( 'redis-cli -h "%s" -p "%s" -a "%s" -n "%d"', $redis_server['host'], $redis_server['port'], $redis_server['auth'], $redis_server['database'] ); - WP_CLI::launch( $cmd ); - + $cmd = WP_CLI\Utils\esc_cmd( 'redis-cli -h %s -p %s -a %s -n %s', $redis_server['host'], $redis_server['port'], $redis_server['auth'], $redis_server['database'] ); + $process = WP_CLI\Utils\proc_open_compat( $cmd, array( STDIN, STDOUT, STDERR ), $pipes ); + $r = proc_close( $process ); + exit( $r ); } /** From 945db7e4530fcf6478a7f18c217e24c2a264e4af Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Mon, 24 Feb 2020 10:39:22 -0800 Subject: [PATCH 2/3] Cast as an int just to be clear --- cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli.php b/cli.php index 55a6388..46ade8d 100644 --- a/cli.php +++ b/cli.php @@ -35,7 +35,7 @@ public function cli() { $cmd = WP_CLI\Utils\esc_cmd( 'redis-cli -h %s -p %s -a %s -n %s', $redis_server['host'], $redis_server['port'], $redis_server['auth'], $redis_server['database'] ); $process = WP_CLI\Utils\proc_open_compat( $cmd, array( STDIN, STDOUT, STDERR ), $pipes ); $r = proc_close( $process ); - exit( $r ); + exit( (int) $r ); } /** From 9ea40ece92cd903b8591ddf5594cc9b2940cdbef Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Mon, 24 Feb 2020 10:48:34 -0800 Subject: [PATCH 3/3] Update README for v0.8.3 --- README.md | 5 ++++- readme.txt | 5 ++++- wp-redis.php | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1005e7..9a1ef0e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** cache, plugin, redis **Requires at least:** 3.0.1 **Tested up to:** 5.3 -**Stable tag:** 0.8.2 +**Stable tag:** 0.8.3 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -107,6 +107,9 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a ## Changelog ## +### 0.8.3 (February 24, 2020) ### +* Fixes `wp redis cli` by using `proc_open()` directly, instead of `WP_CLI::launch()` [[#268](https://github.com/pantheon-systems/wp-redis/pull/268)]. + ### 0.8.2 (January 15, 2020) ### * Catches exceptions when trying to connect to Redis [[#265](https://github.com/pantheon-systems/wp-redis/pull/265)]. diff --git a/readme.txt b/readme.txt index 11a9360..a7a699e 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh Tags: cache, plugin, redis Requires at least: 3.0.1 Tested up to: 5.3 -Stable tag: 0.8.2 +Stable tag: 0.8.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -107,6 +107,9 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a == Changelog == += 0.8.3 (February 24, 2020) = +* Fixes `wp redis cli` by using `proc_open()` directly, instead of `WP_CLI::launch()` [[#268](https://github.com/pantheon-systems/wp-redis/pull/268)]. + = 0.8.2 (January 15, 2020) = * Catches exceptions when trying to connect to Redis [[#265](https://github.com/pantheon-systems/wp-redis/pull/265)]. diff --git a/wp-redis.php b/wp-redis.php index 231d422..d3d6fb2 100644 --- a/wp-redis.php +++ b/wp-redis.php @@ -3,7 +3,7 @@ * Plugin Name: WP Redis * Plugin URI: http://github.com/pantheon-systems/wp-redis/ * Description: WordPress Object Cache using Redis. Requires the PhpRedis extension (https://github.com/phpredis/phpredis). - * Version: 0.8.2 + * Version: 0.8.3 * Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive * Author URI: https://pantheon.io/ */