Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter eltano343

    (@eltano343)

    Thread Starter eltano343

    (@eltano343)

    Sorry, I missed the first email. It went to my spam inbox. We could not try the onboarding wizard because it belongs to the client. We used the manual input instead.

    Thread Starter eltano343

    (@eltano343)

    Hi Anthony. The services.php file simply loops over the list of IPs and call this file directly to the server. It is something like this:

    <?
    $context = stream_context_create(array(
        'http' => array(
            'method' => 'POST',
            'header' => 'Host: www.example.com\r\n",
            'content' => 'f='.urlencode(@$_GET['f']).'&p1='.urlencode($_GET['p1']).'&p2='.urlencode($_GET['p2']))));
    
    foreach($ips as $ip)
        @file_get_contents('https://'.$ip.'/wp-content/plugins/wp-super-cache/multiserver.php?no_propagate_cache_clean=1', false, $context);
    ?>

    Thread Starter eltano343

    (@eltano343)

    I just modified the file wp-cache.php and added this code when the funcion wp_cache_clean_cache starts:

    if(empty($_GET['no_propagate_cache_clean']))
        @file_get_contents('https://xx.xx.xx.xx/wp-content/plugins/services.php?clean_cache=1&f=wp_cache_clean_cache&p1='.urlencode($file_prefix).'&p2='.($all ? '1' : '0'));

    That file, services.php, is in another server (outside the platform) which has the same wordpress installation than the servers in production. Ant it calls another file, called, multiserver.php, inside the wp-super-cache folder which does only the following:

    <?
    include dirname(__FILE__).'/../../../wp-config.php';
    
    $functions_allowed = array();
    
    //$functions_allowed[] = 'wp_cache_post_change';
    //$functions_allowed[] = 'wp_cache_clear_cache';
    $functions_allowed[] = 'wp_cache_clean_cache';
    
    if(in_array(@$_POST['f'], $functions_allowed))
        call_user_func($_POST['f'], @$_POST['p1'], @$_POST['p2']);
    ?>

    It’s not the perfect solution, but it works.

    Thread Starter eltano343

    (@eltano343)

    Finally, I just let each server generate its own cache file. I only modified the plugin to allow deleting the cache in all the servers when the user hits the button “Delete cache”.

    Thread Starter eltano343

    (@eltano343)

    I tested the modification in production and it had to rollback it. It took too much time to run. I am gonna think in a different solution.

    Thread Starter eltano343

    (@eltano343)

    Thanks for the response. Finally, I modified the WP Super Cache plugin to propagate the cache refresh to the other servers.

    I added my function in wp_cache_clear_cache(), wp_cache_clean_cache() and wp_cache_page_update() and it seems to work fine.

Viewing 7 replies - 1 through 7 (of 7 total)