When a new image is added to a draft post / page, WP Rocket deletes the entire cache.
Comes down to:
For a draft get_permalink returns http://example.com/?p=1430
Filtering the url here with rocket_clean_files_users() here
then returns the path of the entire cache folder here:
And thus we have the spice mix for an interesting edge case.
Thanks to @girlie and the sheer luck that prompted her to test this on a draft instead of a published post on her test site and also for making it available for me to test.
Almost missed the main main here, thanks to @Tabrisrp for all the advice, pointers and tips and debugging company.
A hot-fix: after line 56 here: https://github.com/wp-media/wp-rocket/blob/e24f6f9064cbcdaa007512f3464cf53c8e2c67dc/inc/common/purge.php#L53-L56
Add:
// Hotfix for #968
if ( get_post_type( $post_id ) == 'attachment' ) {
return;
}
So that it looks like so: http://snippi.com/s/if5eq20
Most helpful comment
A hot-fix: after line 56 here: https://github.com/wp-media/wp-rocket/blob/e24f6f9064cbcdaa007512f3464cf53c8e2c67dc/inc/common/purge.php#L53-L56
Add:
So that it looks like so: http://snippi.com/s/if5eq20