WordPress.org

Forums

WP Super Cache
Dynamic Caching does not work with latest update (1.4.1) (16 posts)

  1. luxcav
    Member
    Posted 11 months ago #

    I just updated super cache to 1.4.1 and I found my eshop websites broken.

    My eshops are using dynamic caching for displaying a not-cached cart.

    I am using the technique that is explained in this article:

    http://z9.io/2013/10/21/shiny-new-dynamic-content-wp-super-cache/

    Did anyone encounter this problem?

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 11 months ago #

    Have you used the debug log to track what the plugin is doing?

  3. mbrsolution
    Member
    Posted 11 months ago #

    Hi @luxcav have you tested version 1.4.2?

    Regards

  4. luxcav
    Member
    Posted 11 months ago #

    I find no errors on the cache log, but my php reports this:

    [10-Aug-2014 07:41:59 UTC] PHP Warning:  Parameter 1 to dynamic_output_buffer_test() expected to be a reference, value given in D:\WebSite Development\AllaboutMobile\Public_HTML\wp-includes\plugin.php on line 470

    I am using 1.4.2 now but the problem continues.

  5. luxcav
    Member
    Posted 11 months ago #

    I got some reports on the plugin log. Here they are:

    07:54:29 / Supercache Late Init: add wp_cache_serve_cache_file to init
    07:54:29 / Supercache Late Loader running on init
    07:54:29 / wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da/ Cookie detected: wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da
    07:54:29 / wp-cache file exists: D:\WebSite Development\AllaboutMobile\Public_HTML\wp-content\cache\wp-cache-3d2417f590cc88dcbdd0eb0ddb8f329e.html
    07:54:29 / Serving wp-cache dynamic file
    07:54:29 / exit request
    07:54:32 /wp-admin/admin-ajax.php Supercache Late Init: add wp_cache_serve_cache_file to init
    07:54:33 /wp-admin/admin-ajax.php Supercache Late Loader running on init
    07:54:33 /wp-admin/admin-ajax.php wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da/ Cookie detected: wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da
    07:54:33 /wp-admin/admin-ajax.php supercache dir: D:\WebSite Development\AllaboutMobile\Public_HTML/wp-content/cache/supercache/allaboutmobile.copy/wp-admin/admin-ajax.php/
    07:54:33 /wp-admin/admin-ajax.php No Super Cache file found for current URL: D:\WebSite Development\AllaboutMobile\Public_HTML/wp-content/cache/supercache/allaboutmobile.copy/wp-admin/admin-ajax.php/index.html
    07:54:33 /wp-admin/admin-ajax.php In WP Cache Phase 2
    07:54:33 /wp-admin/admin-ajax.php Setting up WordPress actions
    07:54:33 /wp-admin/admin-ajax.php Not caching wp-admin requests.
  6. Donncha O Caoimh
    Member
    Plugin Author

    Posted 11 months ago #

    How are you calling dynamic_output_buffer_test? Are you using add_filter?

    Check out how it's called in the dynamic-cache-test.php, it's a cacheaction there.

    Also, I fixed a bug in that file, grab the development version and copy into wp-super-cache/plugins/

  7. jakus
    Member
    Posted 5 months ago #

    Hello,

    I am also having this issue.. The warning doesn't appear on the local setup of the site.

    But once I push the changes to the live site, I get the warning.

    It doesn't appear to affect the function of the dynamic plugin however :S

    Any ideas what I may need to do?

    luxcav did you get this sorted?

    Cheers,

    J

  8. luxcav
    Member
    Posted 5 months ago #

    I changed the constants which the old script was suggesting (DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT) to something else and everything worked perfectly.

    See below:

    define( 'DYN_TAG', 'CONST_TAG' ); // Change this to a secret placeholder tag
    
    if ( DYN_TAG != '' ) {
    	if (!function_exists(dynamic_output_buffer_test)) {
    	function dynamic_output_buffer_test( $cachedata = 0) {
    		if ( defined( 'DYN_OB_TEXT' ) )
    			return str_replace( DYN_TAG, DYN_OB_TEXT, $cachedata );
    
    		ob_start();
    
    		{do your thing here and you will get dynamic results}
    
    		ob_end_clean();
    
    		if ( $cachedata === 0 ) {
    			define( 'DYN_OB_TEXT', $text );
    		} else {return str_replace( DYN_TAG, $text, $cachedata );}
    	}
    	}
    	add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );
    
    	if (!function_exists(dynamic_output_buffer_init)) {
    		function dynamic_output_buffer_init() {
    		add_action( 'wp_footer', 'dynamic_output_buffer_test' );
    		}
    	}
    	add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
    
    	if (!function_exists(dynamic_output_buffer_test_safety)) {
    		function dynamic_output_buffer_test_safety( $safety ) {
    			if ( defined( 'DYN_OB_TEXT' ) ) {return 1;} else {return 0;}
    			}
    		}
    	add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
    }
  9. jakus
    Member
    Posted 5 months ago #

    Cool!

    Thanks very much for your response luxcav, did you leave this script in the dynamic_cache_test.php file in the plugins directory for wp-super-cache or did you move it to your themes functions.php?

    I will give it a try and let you know how it goes.

    Thanks again.

    J

  10. jakus
    Member
    Posted 5 months ago #

    Just as an update; I changed the constants as you suggested but I am still receiving the php warning on the live site.

    Weird.

  11. jakus
    Member
    Posted 5 months ago #

    Fixed! I realised that in the example script there's an error..

    In the line function dynamic_output_buffer_test( &$cachedata = 0) {

    I had to remove the &.

  12. Amanda Giles
    Member
    Posted 3 months ago #

    I was having the same problem and also removed the "&" in from the of the $cachedata parameter which fixed my issue. It seemed counter intuitive since the error indicates it's expecting a reference (which the "&" does), but the dynamic caching is working and the error is no longer appearing on my page.

    Thank you so much, jakus!

  13. Jay
    Member
    Posted 3 days ago #

    hey jakus,

    Is it possible where "{do your thing here and you will get dynamic results}" is located to call a file, such as example.php?

    Thank you!

  14. Jay
    Member
    Posted 2 days ago #

    Or is there a way to use ajax to do this? Not sure which would be better.

  15. jakus
    Member
    Posted 2 days ago #

    Hi Jay,

    I don't see why you couldn't use an 'include example.php' as the dynamic content?

    e.g <?php include('nameoffile.php'); ?>

    For Ajax; you would need to write a bit of additional javascript.

  16. Jay
    Member
    Posted 1 day ago #

    yup that worked, thanks jakus! For some reason i can not run any if statements in the php file that I call. Same goes for if I check if the page is_single or is_home.

    Any ideas as to why and any suggested workarounds?

    Code example:

    if ( is_single() ) {
    echo "here";
    }

Reply

You must log in to post.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic