From 42b7b890348116001818f80f1e553fd232cd2eb2 Mon Sep 17 00:00:00 2001 From: Josep Roca Date: Tue, 8 Aug 2017 14:54:08 +0300 Subject: [PATCH] FMAINT-326 explicitly require the string true in order for REDIS_SESSION_STORAGE to be applied --- README.md | 13 +++++++++++++ src/Redis.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..de274f7 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# wp-env-heroku-redis + +Expose Heroku redis addon configuration to WordPress. + +Accepted env keys: + +- REDIS_URL: If you are using heroku-redis addon +- REDISCLOUD_URL: If you are using rediscloud addon +- REDIS_SESSION_STORAGE: Set to "true" (without quotes) if you want PHP sessions to be persisted in Redis storage, instead of PHP's default of using machine's temporary directory. This is useful when you need to persist sessions across multiple dynos. + +## Incompatible changes from 1.0.0 + +In v2.0.0, `REDIS_SESSION_STORAGE` explicitly needs to be set to the string "true" instead of a truthy value. diff --git a/src/Redis.php b/src/Redis.php index e797b59..9c142ce 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -9,7 +9,7 @@ define('WP_REDIS_PORT', trim( $url['port'] )); define('WP_REDIS_PASSWORD', trim( $url['pass'] )); - if (getenv('REDIS_SESSION_STORAGE')) { + if (getenv('REDIS_SESSION_STORAGE') && getenv('REDIS_SESSION_STORAGE') === 'true') { ini_set('session.save_handler','redis'); ini_set('session.save_path',"tcp://$url[host]:$url[port]?auth=$url[pass]"); }