| @@ -63,14 +63,27 @@ | ||
| 63 | 63 | 'label' => __( 'Cache server', 'xspeed' ), |
| 64 | 64 | 'description' => __( 'The cache server your host provides. Ask your host if you are not sure.', 'xspeed' ), |
| 65 | 65 | ), |
| 66 | 66 | 'redis_host' => array( |
| 67 | - 'type' => 'string', | |
| 68 | - 'default' => '127.0.0.1', | |
| 69 | - 'constants' => array( 'XSPEED_OC_HOST', 'WP_REDIS_HOST' ), | |
| 70 | - 'label' => __( 'Redis host', 'xspeed' ), | |
| 71 | - 'description' => __( 'Address of the Redis server. Use 127.0.0.1 when Redis runs on the same server as your site.', 'xspeed' ), | |
| 72 | - 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 67 | + 'type' => 'string', | |
| 68 | + 'default' => '127.0.0.1', | |
| 69 | + // WP_REDIS_PATH is Redis Object Cache's name for a unix socket, | |
| 70 | + // and it only means one when WP_REDIS_SCHEME says `unix` -- the | |
| 71 | + // same pair that plugin reads. It ranks above WP_REDIS_HOST | |
| 72 | + // because that plugin ignores the host once the scheme is unix, | |
| 73 | + // and hosts that write the pair often leave a stale host | |
| 74 | + // beside it. (#566) | |
| 75 | + 'constants' => array( 'XSPEED_OC_HOST', 'WP_REDIS_PATH', 'WP_REDIS_HOST' ), | |
| 76 | + 'constants_when' => array( | |
| 77 | + 'WP_REDIS_PATH' => array( | |
| 78 | + 'constant' => 'WP_REDIS_SCHEME', | |
| 79 | + 'is' => 'unix', | |
| 80 | + 'case_insensitive' => true, | |
| 81 | + ), | |
| 82 | + ), | |
| 83 | + 'label' => __( 'Redis host', 'xspeed' ), | |
| 84 | + 'description' => __( 'Address of the Redis server, or the path to its socket file if your host gave you one (for example /run/redis/redis.sock). Use 127.0.0.1 when Redis runs on the same server as your site.', 'xspeed' ), | |
| 85 | + 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), | |
| 73 | 86 | ), |
| 74 | 87 | 'redis_port' => array( |
| 75 | 88 | 'type' => 'int', |
| 76 | 89 | 'default' => 6379, |
| @@ -77,9 +90,9 @@ | ||
| 77 | 90 | 'min' => 1, |
| 78 | 91 | 'max' => 65535, |
| 79 | 92 | 'constants' => array( 'XSPEED_OC_PORT', 'WP_REDIS_PORT' ), |
| 80 | 93 | 'label' => __( 'Redis port', 'xspeed' ), |
| 81 | - 'description' => __( 'The default Redis port is 6379.', 'xspeed' ), | |
| 94 | + 'description' => __( 'The default Redis port is 6379. Not used when the host is a socket path.', 'xspeed' ), | |
| 82 | 95 | 'advanced' => true, |
| 83 | 96 | 'dependsOn' => array( 'field' => 'backend', 'value' => 'redis' ), |
| 84 | 97 | ), |
| 85 | 98 | 'redis_user' => array( |
| @@ -88,9 +101,11 @@ | ||
| 88 | 101 | // WP_REDIS_PASSWORD trails the dedicated names because in its |
| 89 | 102 | // array form -- how xCloud and Cloudways hand out ACL |
| 90 | 103 | // credentials -- it carries the username too. It is pair-only: |
| 91 | 104 | // as a plain string it is a password, never a username. |
| 92 | - 'constants' => array( 'XSPEED_OC_USER', 'WP_REDIS_USER', 'WP_REDIS_PASSWORD' ), | |
| 105 | + // WP_REDIS_USERNAME is Redis Object Cache's name for the same | |
| 106 | + // thing, and that plugin lets it win over the array form. (#566) | |
| 107 | + 'constants' => array( 'XSPEED_OC_USER', 'WP_REDIS_USERNAME', 'WP_REDIS_USER', 'WP_REDIS_PASSWORD' ), | |
| 93 | 108 | 'constants_pair_only' => array( 'WP_REDIS_PASSWORD' ), |
| 94 | 109 | 'constant_pair' => 'user', |
| 95 | 110 | 'label' => __( 'Redis username', 'xspeed' ), |
| 96 | 111 | 'description' => __( 'Only needed if your host gave you a Redis username along with the password. Leave blank otherwise.', 'xspeed' ), |