OK, so did an in-depth review of the code in delete_advanced_cache_clear_artifacts
, which;
- reads the contents of the parent of the autoptimize cache folder (so default
wp-content/cache
)
- for each item in that array is checks if the filename has the prefix
autoptimize-
and if that item is a directory
- only if both conditions are true, it removes the entire directory
Based on this, I consider it next to impossible for this function to delete individual files in wp-content/cache/autoptimize/
except if you used a constant to rename the autoptimize cache-folder into autoptimize-<xyz>
, in which case the entire directory with the real cache would be removed and (shortly after) get recreated by normal AO logic (making it look like individual files were deleted).
Nevertheless I have added a check in said function to make sure it is only active when the “advanced cache clearing” is active as well, if only to ensure this logic isn’t executed when it isn’t needed and I changed the prefix from autoptimize-
into autoptimize-artifacts-
to make sure someone having set the constant to autoptimize-production
or so won’t have the real cache directory deleted.
You can download & test what will become AO26 from https://github.com/futtta/autoptimize/archive/beta.zip ??
frank