pluginkollektiv / cachify

Smart but efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
https://wordpress.org/plugins/cachify/
GNU General Public License v2.0
99 stars 31 forks source link

refactor clearing HDD cache to remove empty directories #289

Closed stklcode closed 7 months ago

stklcode commented 1 year ago

Initially discussed in PR #286 and reported by @raffaelj

My main concern was to delete the empty folder after invalidating the page cache. [...] I think, it would be better to add an additional check, if the folder is empty. If so, the empty folder should be deleted by default - regardless of the $recursive = false option.


Proposed solution:

We opt out early, if a directory was already empty before and delete emptied directories only in recursive mode.

Remove the early return and the additional condition, so we do not leave behind empty directories.

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud