Support » Plugin: Lite Cache » Paginated comment pages aren't cleared/purged

  • Resolved jumbo

    (@jumbo)


    Thanks for the plugin. I noticed that post comment pagination pages aren’t cleared during the typical necessary routines. For instance, let’s say there was the following blog post
    http://example.com/hello/
    and a comment is added, edited, approved, disapproved. Lite Cache will properly clear the first page, but it won’t clear any of the following:

    http://example.com/hello/comment-page-1/
    http://example.com/hello/comment-page-2/
    http://example.com/hello/comment-page-3/
    etc

    Since you’re using a directory structure for caching, wouldn’t it make sense to simply delete the single blog post folder (e.g., hello), which will cascade and delete any paginated items? Like a recursive delete?

    Otherwise, with the cache’s existing logic, it doesn’t look like comment pagination caches would be deleted under any circumstance, short of scheduled garbage collection.

    Thanks.

    https://wordpress.org/plugins/lite-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    Yes, the post related folder is deleted. If not there is some kind of problem in your installation.

    Stefano, thanks for responding. I was testing on a windows environment, and it wasn’t working. I took a look at the remove_dir() function and I think I found where the problem is. You have the following:

    if (substr($file, -1) == '/')
      $this->remove_dir($file);

    The problem is, that particular code assumes the directory separator is a forward slash, but on Windows, it’s a backslash. So Lite Cache will think every directory is a file.

    Replacing the above with the following fixes the recursive delete operation:

    if (substr($file, -1) == DIRECTORY_SEPARATOR)
      $this->remove_dir($file);

    But you also have hard-coded references to ‘/’ throughout the code that assumes a non-Windows environment.

    Plugin Author Stefano Lissa

    (@satollo)

    Fixed. Actually PHP as other multi-os system correctly manages the / as separator, but not for the glob function… 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Paginated comment pages aren't cleared/purged’ is closed to new replies.