After November 2016 Cloudflare will remove support and deactivate their v1 API, which will break this module.
Are there any plans to support the new Cloudflare v4 API?
See this link for more information: https://blog.cloudflare.com/sunsetting-api-v1-in-favor-of-cloudflares-cu...
Migration docs can be found here: https://www.cloudflare.com/migrating-to-v4
The changes for purging a file do not look too drastic: https://www.cloudflare.com/migrating-to-v4/#purge-a-single-file-in-cloud...
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | support-cloudflare-v4-api-2733509-20.patch | 13.33 KB | jh3 |
| #14 | cfpurge-2733509-Support-for-Cloudflare-v4-API-14.patch | 7.04 KB | maindeepak |
| #8 | cfpurge-2733509-Support-for-Cloudflare-v4-API-8.patch | 14.64 KB | maindeepak |
| #2 | cfpurge_adapt_to_cloudflare_v4_api.patch | 7.57 KB | maindeepak |
Comments
Comment #2
maindeepak commentedPatch to Support for Cloudflare's v4 API
Comment #3
maindeepak commentedComment #4
maindeepak commentedComment #5
jackfoust commentedComment #7
chrisfromredfin@maindeepak - it looks like you generated your patch one folder too high. Generate it from right inside the cfpurge module folder, so your git diffs look like:
diff --git a/cfpurge.inc b/cfpurge.incinstead of
diff --git a/cfpurge/cfpurge.inc b/cfpurge/cfpurge.incComment #8
maindeepak commentedThank you @cwells. I have updated the patch.
Comment #9
jackfoust commentedComment #11
jackfoust commented@maindeepak - I think this patch may also be failing to apply because of the file encoding. It looks like it is UTF-16LE. I'm not able to open this file in my NetBeans in this encoding. I can however open in Sublime. You may want to try with us-ascii as the encoding.
Comment #12
chrisfromredfinWas this patch generated from a diff of 7.x-1.2 or from 7.x-1.x-dev? I think the testbot is applying against the tip of the development branch, but I see you updated the issue version to 1.2.
Comment #13
jackfoust commented@cwells - Must be against dev. I was able to apply against dev, with hunk fail of the .inc file on stable.
Comment #14
maindeepak commentedCurrent patch generated from a diff of 7.x-1.x-dev. I have tested against 7.x-1.x-dev and look good.
Hope this time testbot will pass it.
Comment #15
jackfoust commentedComment #18
chrisfromredfinThis seems to me to be an error with the testbot.
It seems like it's trying to apply a patch to run-tests, which won't apply. Might have to kick testbot tomorrow or later after a new patch is made for it, and it is updated.
https://www.drupal.org/files/issues/2551981-21-add-directory-option-to-r...
Comment #19
jh3 commented#2733509-14: Support for Cloudflare's v4 API will be required after November 2016 does not look good.
It looks like every call to cfpurge_serial_request and cfpurge_parallel_request is purging everything. See https://api.cloudflare.com/#zone-purge-all-files
I also noticed cfpurge_serial_request is still looping over $urls. So if there are 10 urls, 10 curl requests are made that purge everything, not just what's in $urls.
Some other things that seem wrong:
- Why call get_zone_identifier() every single time? The zone id will not change. cfpurge_zone_identifier is never actually set.
- This new API seems to make cfpurge_parallel_request useless. All of the URLs you want to purge can be sent in a single curl request.
Comment #20
jh3 commentedAttached is a new patch that: only runs one curl command, does not purge everything, and sets a purge URL. There are some extra watchdog logs too.
Comment #21
jh3 commentedComment #23
jh3 commentedSeems to be failing for no good reason, similar to the patch in #14. Is it because there are no tests included with this module?
Comment #24
jh3 commentedIt's also worth noting that the v1 API does not work for members of multi-user organizations within CloudFlare. The v4 API is needed for multi-user orgs.
Comment #25
maindeepak commentedComment #26
jh3 commentedComment #27
jh3 commentedComment #28
gaborpeter commentedI have a very strange issue with the module while doing some tests, I just wonder if you experienced similar.
When I purge a specific URL via command line with curl, based on the CF docs for v4, all works fine.
However when I purge with the module, although the header of the object turns from HIT to MISS, but it also stays on MISS for a long period of time (like an hour)
While via the command line, I have one MISS and after it directly get's back to HIT as expected.
Comment #29
chrisfromredfin@gaborpeter - I assume you mean with the patched version using #20?
I am currently using this in production, and I'll let you know if anything goes wonky, but I looked over the code and it's great and simple. I appreciate the additional logging. Though this solution "overfixes" the issue, I believe this should go in as-is and for any nit-picks we can open additional issues, as the November deadline is looming...
So, RTBC.
Comment #30
pianomansam commentedI'm also using this patch successfully in production.
Comment #31
El Bandito commentedWould be good to see this committed !
Comment #32
jh3 commentedCommitted. Thanks everyone!
Comment #33
jh3 commentedComment #34
jh3 commented