WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Mobile pages cached but never served (WordPress Mobile Pack) (3 posts)

  1. sliceofpie
    Member
    Posted 1 year ago #

    WordPress Mobile Pack helps SuperCache write separate ("legacy", non-"Super") cache files for mobile visits, but these are never actually served to mobile users. (Non-mobile works fine.)

    Looking at the SuperCache debug logs below: A site visitor is flagged as using a mobile browser, SuperCache looks but does not find the mobile cache file, so it generates new cache file. The next visit to the same page, for some reason it does not find the just-saved cache file, so it generates a new one with the exact same filename as last time...

    Below are debug logs of 2 consecutive visits to the same page, which yield exactly the same result:

    21:43:05 /thisisthepathtothepage wp_cache_check_mobile:
    21:43:05 /thisisthepathtothepage mobile browser detected: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    21:43:05 /thisisthepathtothepage supercache dir: /pathtowordpress/wp-content/cache/supercache/domainname.com/thisisthepathtothepage/
    21:43:05 /thisisthepathtothepage No wp-cache file exists. Must generate a new one.
    21:43:05 /thisisthepathtothepage Adding hook for wpmp mobile detection
    21:43:05 /thisisthepathtothepage Lite detection says is_mobile: 1 and group: nokia_high for User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    21:43:05 /thisisthepathtothepage In WP Cache Phase 2
    21:43:05 /thisisthepathtothepage Setting up WordPress actions
    21:43:05 /thisisthepathtothepage Created output buffer
    14:43:05 /thisisthepathtothepage Output buffer callback
    14:43:05 /thisisthepathtothepage Lite detection says is_mobile: 1 and group: nokia_high for User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    14:43:05 /thisisthepathtothepage Writing non-gzipped buffer to wp-cache cache file.
    14:43:05 /thisisthepathtothepage Renamed temp wp-cache file to /pathtowordpress/wp-content/cache/wp-cache-bd38a301380be222503dbd4e0acdd636.html
    14:43:05 /thisisthepathtothepage Sending buffer to browser
    14:43:05 /thisisthepathtothepage wp_cache_shutdown_callback: collecting meta data.
    14:43:05 /thisisthepathtothepage Writing meta file: /pathtowordpress/wp-content/cache/meta/wp-cache-bd38a301380be222503dbd4e0acdd636.meta
    
    21:42:59 /thisisthepathtothepage wp_cache_check_mobile:
    21:42:59 /thisisthepathtothepage mobile browser detected: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    21:42:59 /thisisthepathtothepage supercache dir: /pathtowordpress/wp-content/cache/supercache/domainname.com/thisisthepathtothepage/
    21:42:59 /thisisthepathtothepage No wp-cache file exists. Must generate a new one.
    21:42:59 /thisisthepathtothepage Adding hook for wpmp mobile detection
    21:42:59 /thisisthepathtothepage Lite detection says is_mobile: 1 and group: nokia_high for User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    21:42:59 /thisisthepathtothepage In WP Cache Phase 2
    21:42:59 /thisisthepathtothepage Setting up WordPress actions
    21:42:59 /thisisthepathtothepage Created output buffer
    14:42:59 /thisisthepathtothepage Output buffer callback
    14:42:59 /thisisthepathtothepage Lite detection says is_mobile: 1 and group: nokia_high for User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B142 Safari/8536.25
    14:42:59 /thisisthepathtothepage Writing non-gzipped buffer to wp-cache cache file.
    14:42:59 /thisisthepathtothepage Renamed temp wp-cache file to /pathtowordpress/wp-content/cache/wp-cache-bd38a301380be222503dbd4e0acdd636.html
    14:42:59 /thisisthepathtothepage Sending buffer to browser
    14:42:59 /thisisthepathtothepage wp_cache_shutdown_callback: collecting meta data.
    14:42:59 /thisisthepathtothepage Writing meta file: /pathtowordpress/wp-content/cache/meta/wp-cache-bd38a301380be222503dbd4e0acdd636.meta

    (Changing WPSC to "legacy" or "PHP" mode yields the same results... But seems like WPSC is looking in supercache directory for non-super (legacy) cache files?)

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

  2. sliceofpie
    Member
    Posted 1 year ago #

    This might seem like an obscure problem, but after trying all different suggested plugin combinations, I still can't get a custom Mobile theme to cache with WP-SuperCache. Has anyone done this successfully? (Custom, not WP Touch's built-in themes...)

  3. Vijay Padhariya
    Member
    Posted 7 months ago #

    Hello,

    I am basically had same problem with one of my site, and I found and fixed the issue temporarily, hope WP-superCache team will sent some changes for this soon.

    here is the file which you need to edit.

    1. Open wp-cache-phase1.php file under wp-content/plugins/wp-super-cache directory
    2. find function name "get_supercache_dir" and replace line below

    return apply_filters( 'wp_super_cache_supercachedir', $cache_path . 'supercache/' . trailingslashit( strtolower( preg_replace( '/:.*$/', '', str_replace( 'http://', '', str_replace( 'https://', '', $home ) ) ) ) ) );

    TO


    return apply_filters( 'wp_super_cache_supercachedir', $cache_path . 'supercache/');

    and you are done.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic