WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
WordPress in directory and cache on post edit not removed (3 posts)

  1. Naki
    Member
    Posted 2 years ago #

    Hello there,
    I have WordPress installed in directory: example.org/news

    WP Super Cache is created under:
    /wp-content/cache/supercache/example.org/news/link/index.html.php
    -> Works OK

    WP Super Cache Settings tab:
    Button to delete all cache files
    -> Works OK

    Post edit page:
    Edit/change post and click save
    -> Error, cache files ale not marked as .needs-rebuild and users get old page version.

    I looked at get_current_url_supercache_dir() function and it returns bad directory path (when deleting cache only, good path for creating):
    /wp-content/cache/supercache/example.org/link/index.html.php
    instead of:
    /wp-content/cache/supercache/example.org/news/link/index.html.php

    Is it WP-Super-Cache bug ?
    It generates path with /news/ when creating cache
    And generates path without /news/ when tries to remove cache on post change

    For hot fix I changed this:
    global $cached_direct_pages, $cache_path, $wp_cache_request_uri;
    to:
    global $cached_direct_pages, $cache_path, $wp_cache_request_uri, $wp_cache_home_path;

    And this:
    $uri = str_replace( '\\', '', $uri );
    to:

    $uri = str_replace( '\\', '', $uri );
    if(strpos($uri,$wp_cache_home_path) !== 0) {
        $uri = rtrim($wp_cache_home_path, '/') . $uri;
    }

    And now it works for post edit...

    Thanks for some response.

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for that but it can't go in there as it is. Sites that use WordPress in a directory but are served from the root will have the extra prefix (news in this case) added to the path. This is tricky :(

  3. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Fixed it, by putting the rtrim commands in a different place where they won't affect users of the sites described in my previous post.

    Dev version should update in the next 20 minutes if you'd like to give it a go?

    http://ocaoimh.ie/y/2o

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic