Skip to content

Commit

Permalink
Merge pull request #268 from pantheon-systems/use-proc-open-directly
Browse files Browse the repository at this point in the history
Fix `wp redis cli` by using `proc_open()` directly
  • Loading branch information
danielbachhuber authored Feb 24, 2020
2 parents dd58ff8 + 9ea40ec commit 79e64c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)].

Expand Down
8 changes: 5 additions & 3 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function cli() {
$redis_server = array(
'host' => '127.0.0.1',
'port' => 6379,
'auth' => '',
);
}
}
Expand All @@ -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( (int) $r );
}

/**
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)].

Expand Down
2 changes: 1 addition & 1 deletion wp-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/
*/
Expand Down

0 comments on commit 79e64c5

Please sign in to comment.