• Resolved wrigs1

    (@wrigs1)


    Hi
    Advanced Cache Plugin for plugin developers no longer appears to work under v150626.

    I’ve tested with both my own and your example plugin. Under previous versions of Zencache your example plugin for a non-mobile browser correctly caches with a “suffix” of “other” when I use my desktop:

    <!-- ZenCache file path: /cache/zencache/cache/http/example-com/about.v/other.html -->
    <!-- ZenCache file built for (other  http://example.com/about/) in 0.27610 seconds, on: Jun 28th, 2015 @ 7:20 pm UTC. -->

    but under the latest version no suffixing occurs to separately cache mobile and desktop output.

    As it is mentioned in “Features” I assume this functionality is still supposed to be present.

    Any advice/info appreciated.

    https://wordpress.org/plugins/zencache/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Raam Dev

    (@raamdev)

    @wrigs1 Would you mind posting the code for your AC Plugin?

    In fact it appears that the load_ac_plugins() function is not written in the advanced_cache file from the advanced_cache_tpl

    Plugin Author JasWSInc

    (@jaswsinc)

    @wrigs1 writes…

    I assume this functionality is still supposed to be present.

    That’s correct. It is still in the current release of ZenCache. Happy to take a look at your AC plugin file if you continue to have trouble.

    @dams83 writes…

    it appears that the load_ac_plugins() function is not written in the advanced_cache

    The call is still there and ZenCache continues to support AC plugins. See source code in the latest release. However, the code that loads AC plugins was refactored in the latest release; i.e., it can be a bit confusing, because the code is not in the same place as it was.

    Plugin Author JasWSInc

    (@jaswsinc)

    Referencing: AcPluginUtils.php

    See also. Updated AC plugin example file.

    Plugin Author JasWSInc

    (@jaswsinc)

    @wrigs1 writes…

    Under previous versions of Zencache your example plugin

    Copy that. I just took a second look and I can confirm this problem also.

    I opened a bug report with a pull request here, along with a short-term workaround and explanation. Thank you for reporting!

    Please see: https://github.com/websharks/zencache/issues/514

    Plugin Author JasWSInc

    (@jaswsinc)

    A fix for this issue was pushed to the latest copy of ZenCache v150626 as part of critical revision just now. Thanks again for reporting!

    Plugin Author Raam Dev

    (@raamdev)

    @wrigs1 @dams83 Thank you for reporting this important issue! As Jason mentioned above, we’ve emergency-patched the latest release (v150626) so you just need to download it again and you should get the patched copy.

    Thread Starter wrigs1

    (@wrigs1)

    Thanks JasWSInc & raamdev for the rapid response and quick fix.

    From the links above (without wading through ZC code) it appears that the “AC class” is now “zencache_advanced_cache” whereas under previous versions it was “zencache__advanced_cache” (with a DOUBLE underscore).

    I assume this change to a single underscore is not a typo; and to ensure my plugin is backwards compatible with older versions of ZC/QC I’ll have to do something like this:

    if ( !empty($GLOBALS['zencache_advanced_cache']) ):
        $ac = $GLOBALS['zencache_advanced_cache'];
        $ac->add_filter('zencache_version_salt', 'my_salt_shaker');
    elseif ( !empty($GLOBALS['zencache__advanced_cache']) ):
        $ac =  $GLOBALS['zencache__advanced_cache'];
        $ac->add_filter(get_class($ac). '__version_salt', 'my_salt_shaker');
    else:
        $ac = $GLOBALS['quick_cache__advanced_cache'];
        $ac->add_filter(get_class($ac). '__version_salt', 'my_salt_shaker');
    endif;

    Also; I assume in other plugins to detect whether a site is using ZC/QC I’ll need to do something like:

    if( class_exists('\\quick_cache\\plugin')
      || class_exists('\\zencache\\plugin')
      || !empty($GLOBALS['zencache_advanced_cache']) )
    // then the site is using ZC/QC

    Plugin Author Raam Dev

    (@raamdev)

    @wrigs1 Yes, all of that looks correct.

    The only note that I would make is that instead of $ac->add_filter you can now use $ac->addFilter(), which is the most up-to-date call (either way currently works fine).

    Plugin Author JasWSInc

    (@jaswsinc)

    I assume this change to a single underscore is not a typo

    Correct. Not a typo. Looks good to me, other than addFilter() as Raam mentioned 🙂

    Thread Starter wrigs1

    (@wrigs1)

    @raamdev @jaswsinc Thanks again for the quick response/fantastic support.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘ZenCache ac plugins not working under v150626’ is closed to new replies.