Skip to content

Commit 14d740b

Browse files
committed
Merge branch 'develop'
2 parents e580c96 + 29c805c commit 14d740b

File tree

10 files changed

+279
-215
lines changed

10 files changed

+279
-215
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 2.5.2
4+
5+
- Respect `WP_REDIS_FLUSH_TIMEOUT` in Lua flush scripts
6+
- Improve `DISALLOW_FILE_MODS` support
7+
- Reverted behavioral change to `sanitize_key_part()`
8+
- Fixed rare fatal error in `show_error_and_die()` (again)
9+
310
## 2.5.1
411

512
- Added timeouts to diagnostics

FAQ.md

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,35 @@
22

33
When in doubt try flushing the cache, you'd be surprised how often this resolves issues. Welcome to WordPress ✌️
44

5-
<details>
6-
<summary>HELP! My site is down!1!!11!!11</summary>
5+
- [HELP! My site is down!1!!11!!11](#help-my-site-is-down11111)
6+
- [Plugin is incompatible with OtherPlugin](#plugin-is-incompatible-with-otherplugin)
7+
- [Status: <code>Not connected</code>](#status-not-connected)
8+
- [<code>connection timed out</code> and <code>read error on connection</code>](#connection-timed-out-and-read-error-on-connection)
9+
- [How can I exclude a page from the cache?](#how-can-i-exclude-a-page-from-the-cache)
10+
- [My site is getting redirected another domain](#my-site-is-getting-redirected-another-domain)
11+
- [Are transients stored in Redis?](#are-transients-stored-in-redis)
12+
- [I'm getting <code>404</code> errors](#im-getting-404-errors)
13+
- [WordPress is slower with Redis Object Cache enabled](#wordpress-is-slower-with-redis-object-cache-enabled)
14+
- [<code>NOAUTH Authentication required</code>](#noauth-authentication-required)
15+
- [<code>Allowed memory size of 1337 bytes exhausted</code>](#allowed-memory-size-of-1337-bytes-exhausted)
16+
- [<code>OOM command not allowed</code>](#oom-command-not-allowed)
17+
- [<code>Flushing the cache causes timeout</code>](#flushing-the-cache-causes-timeout)
18+
- [Unable to flush the cache](#unable-to-flush-the-cache)
19+
- [Cache is flushed constantly](#cache-is-flushed-constantly)
20+
- [Flushing the cache regularly](#flushing-the-cache-regularly)
21+
- [How can I uninstall the cache?](#how-can-i-uninstall-the-cache)
22+
23+
## HELP! My site is down!1!!11!!11
724

825
The easiest way to to disable Redis on your site is deleting the `wp-content/object-cache.php` drop-in file. Alternatively, you can set the `WP_REDIS_DISABLED` constant to `true` to bypass loading it.
9-
</details>
1026

11-
<details>
12-
<summary>Plugin is incompatible with OtherPlugin</summary>
27+
## Plugin is incompatible with OtherPlugin
1328

1429
Unfortunately many plugin authors don't bother testing their plugins with a persistent object cache. If you’re experiencing a compatibility issue with another plugin in combination with Redis Object Cache, please contact the support team of the **other plugin** regarding the issue.
1530

1631
This plugin is **not the issue**, it's just providing WordPress with `wp_cache_*()` functions for persistent caching.
17-
</details>
1832

19-
<details>
20-
<summary>Status: <code>Not connected</code></summary>
33+
## Status: <code>Not connected</code>
2134

2235
This means that either [Redis Server](https://redis.io) is not installed and running, or the plugin is not configured correctly.
2336

@@ -40,23 +53,17 @@ require_once(ABSPATH . 'wp-settings.php');
4053
```
4154

4255
If you moved all constants above those lines and the plugin still shows `Not Connected`, double check your [connection options](https://github.com/rhubarbgroup/redis-cache#connections), or ask your hosting provider for assistance.
43-
</details>
4456

45-
<details>
46-
<summary><code>connection timed out</code> and <code>read error on connection</code></summary>
57+
## <code>connection timed out</code> and <code>read error on connection</code>
4758
If the error occurs rarely, ignore it, Redis Server is having a hiccup. If it persists, read the answer to "Status: <code>Not connected</code>".
48-
</details>
4959

50-
<details>
51-
<summary>How can I exclude a page from the cache?</summary>
60+
## How can I exclude a page from the cache?
5261

5362
Object caching caches only **objects**, not **pages**. You cannot exclude a page from using the object cache, because object caching is not URL-centric. You also cannot exclude the WordPress admin dashboard from using object caching, because then you risk the cache going stale and even loosing data.
5463

5564
If you’re experiencing a compatibility issue with another plugin in combination with Redis Object Cache, please contact the support team of the plugin regarding the issue and ask them to ensure it's compatible with persistent object cache backends, like Redis.
56-
</details>
5765

58-
<details>
59-
<summary>My site is getting redirected another domain</summary>
66+
## My site is getting redirected another domain
6067

6168
That happens when the same `WP_REDIS_DATABASE` index is used for multiple WordPress installations. You **MUST** set a separate `WP_REDIS_DATABASE` and `WP_REDIS_PREFIX` for each domain to avoid data collision.
6269

@@ -65,10 +72,8 @@ Once your site is being redirected, you **MUST** flush the entire Redis Server u
6572
```bash
6673
redis-cli -h 127.0.01 -p 6379 FLUSHALL
6774
```
68-
</details>
6975

70-
<details>
71-
<summary>Are transients stored in Redis?</summary>
76+
## Are transients stored in Redis?
7277

7378
Yes. The WordPress [Transients API](https://developer.wordpress.org/apis/transients/) will use Redis to store transients and not the `options` table.
7479

@@ -83,10 +88,8 @@ DELETE FROM `wp_options`
8388
WHERE `option_name` LIKE '_transient_%'
8489
OR `option_name` LIKE '_site_transient_%';
8590
```
86-
</details>
8791

88-
<details>
89-
<summary>I'm getting <code>404</code> errors</summary>
92+
## I'm getting <code>404</code> errors
9093

9194
This may be an issue with WordPress 6.1's [query caching](https://make.wordpress.org/core/2022/10/07/improvements-to-wp_query-performance-in-6-1/) feature, which you can disable by creating your own [Must Use Plugin](https://wordpress.org/documentation/article/must-use-plugins/) containing this snippet:
9295

@@ -96,58 +99,45 @@ add_action( 'parse_query', function ( $wp_query ) {
9699
} );
97100
```
98101

99-
</details>
100-
101-
<details>
102-
<summary>WordPress is slower with Redis Object Cache enabled</summary>
102+
## WordPress is slower with Redis Object Cache enabled
103103

104104
This should never always means **something is broken**.
105105

106106
1. Does the plugin show "Connected"?
107107
2. Is Redis Server responding too slowly? Run `redis-cli --latency-history` to find out.
108108
3. Is Redis Server maxing out it's RAM or CPU?
109-
</details>
110109

111-
<details>
112-
<summary><code>NOAUTH Authentication required</code></summary>
110+
## <code>NOAUTH Authentication required</code>
113111

114112
You either need to add the `WP_REDIS_PASSWORD` constant to your `wp-config.php` file, or move the constant above higher up in your `wp-config.php` file, above these lines:
115113

116114
```php
117115
/* That's all, stop editing! Happy publishing. */
118116
require_once(ABSPATH . 'wp-settings.php');
119117
```
120-
</details>
121118

122-
<details>
123-
<summary><code>Allowed memory size of 1337 bytes exhausted</code></summary>
119+
## <code>Allowed memory size of 1337 bytes exhausted</code>
124120

125121
This can happen when using a persistent object cache. Increase PHP's memory limit.
126122

127123
- <https://wordpress.org/documentation/article/common-wordpress-errors/#allowed-memory-size-exhausted>
128124
- <https://woocommerce.com/document/increasing-the-wordpress-memory-limit/>
129-
</details>
130125

131-
<details>
132-
<summary><code>OOM command not allowed</code></summary>
126+
## <code>OOM command not allowed</code>
133127

134128
This can happen when Redis Server runs out of memory and no `maxmemory-policy` was set in the `redis.conf`.
135129

136130
- <https://aws.amazon.com/premiumsupport/knowledge-center/oom-command-not-allowed-redis/>
137131

138132
Alternatively, you can set the `WP_REDIS_MAXTTL` constant to something relatively low (like `3600` seconds) and flush the cache.
139-
</details>
140133

141-
<details>
142-
<summary><code>Flushing the cache causes timeout</code></summary>
134+
## <code>Flushing the cache causes timeout</code>
143135

144136
This can happen when the dataset in Redis Server is quite large. Consider increasing `WP_REDIS_READ_TIMEOUT` and `WP_REDIS_FLUSH_TIMEOUT` to 5-10 seconds.
145137

146138
Alternatively, starting with Redis 6.2, setting the `lazyfree-lazy-user-flush` in the `redis.conf` configuration directive to `yes` changes the default flush mode to be asynchronous.
147-
</details>
148139

149-
<details>
150-
<summary>Unable to flush the cache</summary>
140+
## Unable to flush the cache
151141

152142
If your site is unreachable, you can flush the cache without access to the WordPress dashboard.
153143

@@ -158,10 +148,8 @@ redis-cli -h 127.0.01 -p 6379 FLUSHALL
158148
```
159149

160150
Alternatively, you can use a desktop client like [Medis](https://getmedis.com) or [RedisInsight](https://redis.com/redis-enterprise/redis-insight/) to connect to your Redis Server and flush it by executing `FLUSHALL`.
161-
</details>
162151

163-
<details>
164-
<summary>Cache is flushed constantly</summary>
152+
## Cache is flushed constantly
165153

166154
If you don't see metrics building up, or your site is not getting faster, you might have an active plugin that flushes the object cache frequently. To diagnose this issue you can use the following snippet to find the source of the cache flush:
167155

@@ -176,10 +164,8 @@ add_action( 'redis_object_cache_flush', function( $results ) {
176164
```
177165

178166
Once you found the plugin responsible by checking `redis-cache-flush.log`, you can contact the plugin author(s) and reporting the issue.
179-
</details>
180167

181-
<details>
182-
<summary>Flushing the cache regularly</summary>
168+
## Flushing the cache regularly
183169

184170
It's considered a bad practise to flush the frequently, but sometimes 3rd party plugins and themes just don't play nice with persistent object caches. When the plugin/theme authors refuse to fix their code you can use [WP Cron](https://developer.wordpress.org/plugins/cron/) to flush the Redis object cache frequently.
185171

@@ -190,12 +176,9 @@ if ( ! wp_next_scheduled( 'flush_redis_cache' ) ) {
190176

191177
add_action( 'flush_redis_cache', 'wp_cache_flush' );
192178
```
193-
</details>
194179

195-
<details>
196-
<summary>How can I uninstall the cache?</summary>
180+
## How can I uninstall the cache?
197181

198182
Before [uninstalling the plugin](https://wordpress.org/documentation/article/manage-plugins/#uninstalling-plugins-1), be sure to disable the cache via `WordPress -> Settings -> Redis`.
199183

200184
If you already removed the plugin before doing so, you can delete the `object-cache.php` file in your `/wp-content/` directly.
201-
</details>

includes/class-plugin.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ public function add_plugin_row_meta( array $plugin_meta, $plugin_file ) {
299299
* @param bool $as_html
300300
* @return string
301301
*/
302-
public function link_to_ocp($medium, $as_html = true)
303-
{
302+
public function link_to_ocp($medium, $as_html = true){
304303
$ref = 'oss';
305304

306305
if ( self::acceleratewp_install( true ) ) {
@@ -822,8 +821,7 @@ public function render_admin_bar( $wp_admin_bar ) {
822821
*
823822
* @return string
824823
*/
825-
protected function admin_bar_style()
826-
{
824+
protected function admin_bar_style() {
827825
return <<<HTML
828826
<style>
829827
#wpadminbar ul li.redis-cache-error {
@@ -843,8 +841,7 @@ protected function admin_bar_style()
843841
*
844842
* @return string
845843
*/
846-
protected function admin_bar_script()
847-
{
844+
protected function admin_bar_script() {
848845
$nonce = wp_create_nonce();
849846
$ajaxurl = esc_url( admin_url( 'admin-ajax.php' ) );
850847
$flushMessage = __( 'Flushing cache...', 'redis-cache' );
@@ -1274,8 +1271,7 @@ function_exists( 'size_format' ) ? size_format( $bytes ) : "{$bytes} bytes",
12741271
*
12751272
* @return bool
12761273
*/
1277-
protected function incompatible_content_type()
1278-
{
1274+
protected function incompatible_content_type() {
12791275
$jsonContentType = static function ($headers) {
12801276
foreach ($headers as $header => $value) {
12811277
if (stripos((string) $header, 'content-type') === false) {
@@ -1586,8 +1582,7 @@ public function current_user_can_manage_redis() {
15861582
*
15871583
* @return void
15881584
*/
1589-
public function litespeed_disable_objectcache()
1590-
{
1585+
public function litespeed_disable_objectcache() {
15911586
if ( isset( $_POST['LSCWP_CTRL'], $_POST['LSCWP_NONCE'], $_POST['object'] ) ) {
15921587
$_POST['object'] = '0';
15931588
}

0 commit comments

Comments
 (0)