• Resolved nyssamccanmore

    (@nyssamccanmore)


    After updating to 2.4.0, I go to my dashboard and everything starts flickering. It’s hard to get anything to work because the pages keep refreshing. I also get this error message:

    PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘autoptimize_flush_pagecache’ not found or invalid function name in /home/[redacted]/public_html/main/wp-includes/class-wp-hook.php on line 284

    When I first saw this this afternoon, I was finally able to turn on Rollback and go back to 2.3.4. Then Jetpack automatically updated the plugin again, but everything seemed to be working okay now, so I left it.

    Hours later, I opened my dashboard again, and the flickering was happening again. Once again I managed to roll it back to 2.3.4, turned off Jetpack’s automatic update, and now it’s fine.

    I am using this snippet:

    // Automatically clear Autoptimize cache if it goes beyond 2GB
    if (class_exists(‘autoptimizeCache’)) {
    $myMaxSize = 10000; # You may change this value to lower like 500000 for 500MB if you have limited server space
    $statArr=autoptimizeCache::stats();
    $cacheSize=round($statArr[1]/1024);

    if ($cacheSize>$myMaxSize){
    autoptimizeCache::clearall();
    header(“Refresh:0”); # Refresh the page so that autoptimize can create new cache files and it does not break the page after clearall.
    }
    }

    …But I don’t know if this is actually related, because I use the snippet with Autoptimize on two sites, and the other site is running normally.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    it looks like *something* (another plugin?) is calling autoptimize_flush_pagecache, which is a function which does not exist any more.

    2 solutions, either;
    * try to find the plugin that does that and disable/ change it
    * or try the following snippet (which re-declares autoptimize_flush_pagecache as a wrapper for the newer equivalent);

    function autoptimize_flush_pagecache() {
        autoptimizeCache::flushPageCache();
    }

    the fact that the page keeps refreshing does indicate your snippet (with the header(“Refresh:0”);) is somehow related (but it’s not the one calling autoptimize_flush_pagecache).

    hope this helps,
    frank

    Thread Starter nyssamccanmore

    (@nyssamccanmore)

    When I first installed the new snippet, it spit out this:

    PHP Fatal error: Uncaught Error: Call to undefined method autoptimizeCache::flushPageCache() in /home/[redacted]/public_html/main/wp-content/plugins/code-snippets/php/snippet-ops.php(353) : eval()’d code:4
    Stack trace:
    #0 /home/*/public_html/main/wp-includes/class-wp-hook.php(284): autoptimize_flush_pagecache()
    #1 /home/*/public_html/main/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)
    #2 /home/*/public_html/main/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #3 /home/*/public_html/main/wp-content/plugins/autoptimize/classes/autoptimizeCache.php(98): do_action(‘autoptimize_act…’)
    #4 /home/*/public_html/main/wp-includes/class-wp-hook.php(286): autoptimize_do_cachepurged_action(”)
    #5 /home/*/public_html/main/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(Object(WP_Error), Array)
    #6 /home/*/public_html/main/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #7 /home/*/public_html/main/wp-includes/load.php(679): do_action(‘shutd in /home/*/public_html/main/wp-content/plugins/code-snippets/php/snippet-ops.php(353) : eval()’d code on line 4

    Yet so far, the site is working normally, with no more error messages. I’ll keep an eye on it and see how things go.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    thanks for the feedback, fingers crossed ??

    Thread Starter nyssamccanmore

    (@nyssamccanmore)

    No more php errors, but the flickering is back. Also, the snippet to clear the cache no longer appears to be working. I turned off the snippet, which got the flickering to stop, but that means my cache will start filling up fast and have to be cleared manually.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    which confirms the snippet is causing the refresh.

    -> simple solution (while keeping the snippet) would be to comment out the header(“Refresh:0”); line.

    -> better solution would be to configure AO to not fill up cache that fast (the “aggregate inline” options first and foremost).

    -> the in-between solution would be to check if the snippet needs updating (I think the size stuff might be wrong).

    Thread Starter nyssamccanmore

    (@nyssamccanmore)

    The aggregate inline JS setting makes it fill up, but I have it turned on because of the dramatic improvement in my page speed and scores. I would hate to have to turn it off.

    I commented out the line; I’ll see how it works now.

    Thread Starter nyssamccanmore

    (@nyssamccanmore)

    I found a plugin to clear the cache: https://www.ads-software.com/plugins/cache-cleaner/ I’ll see if replacing the snippet with this, fixes the problem.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    closing here as the problem is not with AO but rather something hooking into AO, but hope cache-cleaner works for you ??

    have a nice day!
    frank

    Thread Starter nyssamccanmore

    (@nyssamccanmore)

    Yep, the plugin fixed the problem. Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘2.4.0 causes errors’ is closed to new replies.