WordPress.org

Forums

Lite Cache
[resolved] Paginated comment pages aren't cleared/purged (4 posts)

  1. jumbo
    Member
    Posted 1 year ago #

    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/

  2. Stefano Lissa
    Member
    Plugin Author

    Posted 1 year ago #

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

  3. jumbo
    Member
    Posted 1 year ago #

    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.

  4. Stefano Lissa
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Lite Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.