if any of the cache folders under ezp_root/var/ is symlinked to a dir outside the ezp_root, no cache will ever be cleaned. the ezDir::recursiveDelete() checks that the absolute path is outside the root and fails.
- mv ezpublish_legacy/var/cache /some/path/elsewhere
- ln -s /some/path/elsewhere ezpublish_legacy/var/cache
- clear caches from admin or command line
- inspect the symlinked folder, all files all still there
there are no errors in log, but hacking the recursiveDelete() to write a message with the result shows clearly that the return value is False.