• Resolved frafor

    (@frafor)


    Hi guys, I’m giving a go to this plugin which seems to be awesome.

    I have a bilingual ecommerce website cloned on a test domain to see how it works.

    It’s all based on WPML+WooCommerce.

    The website is EN/DE with DE being the primary language. Permalink structure is set to show the language base for both, so we have:

    domainname.com/de/
    domainname.com/en/

    After a general plugin setup, I noticed on Cloudflare that this is the general pagerule being created:

    View post on imgur.com

    So that should mean that all the /en/ content won’t be cached right?

    Am I supposed to add domainname.com/en/* as a second rule?

    Thanks

Viewing 12 replies - 16 through 27 (of 27 total)
  • Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    can you tell me if the issue related to the home url is fixed on 4.4.1 version? You should disable and re-enable the page cache.

    Thread Starter frafor

    (@frafor)

    Hi Salvatore, just checked, seems to work fine!

    Did you take a look to the WPML-related on cache purge issue too? Unfortunately I couldn’t yet, hope this week I’ll be able

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    I will look the WPML related this week. I released the 4.4.1 to fix a security bug but in the meantime I fixed also the first WPML issue ’cause it was faster to fix

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    I just installed WPML 4.4.9, created 2-3 pages in another language (IT) and the cache was correctly purged on post edit:

    [2021-01-30 08:24:06] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 2909 and related contents
    [2021-01-30 08:24:06] [cache_controller::purge_cache_queue_write] URLs in purge queue Array
    (
        [purge_all] => 
        [urls] => Array
            (
                [0] => https://testcw.speedywp.it/it/about/
                [1] => https://testcw.speedywp.it/it/author/salvatore/
                [2] => https://testcw.speedywp.it/it/author/salvatore/feed/
                [3] => https://testcw.speedywp.it/it/
                [4] => https://testcw.speedywp.it/news/
                [5] => https://testcw.speedywp.it/
            )
    
    )
    
    [2021-01-30 08:24:06] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 2909 and related contents
    [2021-01-30 08:24:06] [cache_controller::purge_cache_queue_job] I'm the purge cache cronjob
    [2021-01-30 08:24:06] [cloudflare::purge_cache_urls] Request URL: https://api.cloudflare.com/client/v4/zones/dc01f92e8be6642f4ac1254cc96babff/purge_cache
    [2021-01-30 08:24:06] [cloudflare::purge_cache_urls] Request Body: {"files":["https:\/\/testcw.speedywp.it\/it\/about\/","https:\/\/testcw.speedywp.it\/it\/author\/salvatore\/","https:\/\/testcw.speedywp.it\/it\/author\/salvatore\/feed\/","https:\/\/testcw.speedywp.it\/it\/","https:\/\/testcw.speedywp.it\/news\/","https:\/\/testcw.speedywp.it\/"]}
    [2021-01-30 08:24:06] [cloudflare::purge_cache_urls] Response: {
      "result": {
        "id": "dc01f92e8be6642f4ac1254cc96babff"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2021-01-30 08:24:06] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2021-01-30 08:24:06] [cache_controller::purge_cache_queue_job] Cache purging complete

    As you can see the response from Cloudflare is success as in your case. I see the changes when by browsing the pages in incognito mode. I’m unable to replicate your issue..

    The weird parameters maybe depend on your WPML settings? Take a look to method get_post_related_links on cache_controller.class.php

    Thread Starter frafor

    (@frafor)

    Hi Salvatore, thanks for the info, i had already noted that method yesterday, will check it during next week!

    Thread Starter frafor

    (@frafor)

    Hi Salvatore, I think I’ve found the culprit.

    So after some days leaving the website free to go while purging single-page here and there, I had time today to check the logs and this is what I came up with:

    [2021-02-01 11:15:54] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 1658 and related contents
    [2021-02-01 11:15:54] [cache_controller::purge_cache_queue_write] URLs in purge queue Array
    (
        [purge_all] => 
        [urls] => Array
            (
                [0] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=xl
                [1] => https://mydomain.com/de/?taxonomy=product_visibility&term=outofstock
                [2] => https://mydomain.com/de/author/{edited:username}/
                [3] => https://mydomain.com/de/author/{edited:username}/feed/
                [4] => https://mydomain.com/de/
                [5] => https://mydomain.com/de/blog/
                [6] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=s
                [7] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=xs
                [8] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=m
                [9] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=l
                [10] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=l
                [11] => https://mydomain.com/de/author/{edited:username}/
                [12] => https://mydomain.com/de/author/{edited:username}/feed/
                [13] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=m
                [14] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=s
                [15] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=xl
                [16] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=xs
                [17] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=l-en
                [18] => https://mydomain.com/en/author/{edited:username}/
                [19] => https://mydomain.com/en/author/{edited:username}/feed/
                [20] => https://mydomain.com/en/
                [21] => https://mydomain.com/en/blog/
                [22] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=m-en
                [23] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=s-en
                [24] => https://mydomain.com/en/?taxonomy=product_visibility&term=outofstock
                [25] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=xl-en
                [26] => https://mydomain.com/en/product/jumper/?attribute_pa_groesse=xs-en
                [27] => https://mydomain.com/de/?product_visibility=outofstock
                [28] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=l-en
                [29] => https://mydomain.com/en/author/{edited:username}/
                [30] => https://mydomain.com/en/author/{edited:username}/feed/
                [31] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=m-en
                [32] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=s-en
                [33] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=xl-en
                [34] => https://mydomain.com/en/product/t-shirt/?attribute_pa_groesse=xs-en
            )
    
    )

    So I noticed that even some WooCommerce attributes with no archives resulted in purging URLs with GET parameters.

    The ‘translation_priority’ tag mentioned before it’s a custom taxonomy too registerd by WPML Translation Management plugin.

    So I changed the method get_post_related_links($postid) at line 991 to check if the taxonomy is public. If a taxonomy isn’t public, it do not have rewrites thus the term links are not pretty.

    This way:

    [...]
    //Purge taxonomies terms URLs
            $postTypeTaxonomies = get_object_taxonomies($postType);
            
            foreach ($postTypeTaxonomies as $taxonomy) {
                // if taxonomy isn't public / has no rewrites we shouldn't be adding urls
                $taxonomy = get_taxonomy($taxonomy);
                if($taxonomy->public == false || $taxonomy->rewrite == false) {
                    continue;
                }
    [...]

    It’s working fine now when I click “Purge cache for this page only” and on simple post edit/publish event (I have to wait for my custom cron job to start it that case, as it runs twice per hour).

    It would be great if you could include this fix in future releases.

    • This reply was modified 5 years, 4 months ago by Yui.
    • This reply was modified 5 years, 4 months ago by frafor.
    Thread Starter frafor

    (@frafor)

    @salvatorefresta could you please tell me when you are planning to integrate the fix above? Thanks

    • This reply was modified 5 years, 4 months ago by frafor.
    Thread Starter frafor

    (@frafor)

    Sorry to bother, but the one proposed is a pretty quick fix with a huge impact on the plugin’s functionality, could you please answer?

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    sorry for the delate. I will release this together with other fixes within few days.

    Thank you

    Thread Starter frafor

    (@frafor)

    Thank to you for the great work! ^_^ I’m just in a hurry because once this is fixed I have few ecommerces to move on cloudflare 🙂

    Thread Starter frafor

    (@frafor)

    Thanks for v.4.4.4!

    • This reply was modified 5 years, 3 months ago by frafor.
    Plugin Contributor iSaumya

    (@isaumya)

    No problem @frafor. Sorry for the delay. If you get a chance don’t forget to share a review. 🙂

Viewing 12 replies - 16 through 27 (of 27 total)

The topic ‘Page rule setting with WPML’ is closed to new replies.