Clear entire cache removes the fastcgi_cache_path directory
-
I’ve noticed that the “Clear entire cache” function executes a
$wp_filesystem->rmdir( $path, $recursive );
which has the unwanted effect of deleting the directory configured as the fastcgi cache path. This call should instead delete only the content of this directory, leaving the directory itself unchanged.For example, I have configured:
fastcgi_cache_path /var/nginx/fastcgi_cache levels=1:2 keys_zone=generic:100m inactive=24h;
I install the plugin, activate it and browse some of the pages, the nginx cache is populated as expected:
$ ls -lhR /var/nginx/fastcgi_cache/ /var/nginx/fastcgi_cache/: total 4.0K drwx------ 4 www www 4.0K Feb 10 16:25 c /var/nginx/fastcgi_cache/c: total 8.0K drwx------ 2 www www 4.0K Feb 10 16:25 9b drwx------ 2 www www 4.0K Feb 10 16:19 ce /var/nginx/fastcgi_cache/c/9b: total 16K -rw------- 1 www www 13K Feb 10 16:25 bb179c0a251c4f6e1d0244513a8769bc /var/nginx/fastcgi_cache/c/ce: total 24K -rw------- 1 www www 24K Feb 10 16:19 71b1db31af259d63f6d8f12987a73cec
I then choose “Clear entire cache”, which correctly empties the cache, but the cache directory has been removed as well:
ls -lhR /var/nginx/fastcgi_cache/ ls: cannot access /var/nginx/fastcgi_cache/: No such file or directory
This bug is not too serious, since nginx is able to recreate the FastCGI cache directory on its own; however, I still think that it’s worth fixing to avoid deleting a filesystem object explicitly referenced in the nginx configuration.
- The topic ‘Clear entire cache removes the fastcgi_cache_path directory’ is closed to new replies.