From b9e695abad340d2b307a24c83d89b0a8efc3fe2d Mon Sep 17 00:00:00 2001 From: Denis Mir Date: Fri, 26 Aug 2022 11:21:37 +0200 Subject: [PATCH] [BUGFIX] Fixes flushAllUrls for CloudflareProxyProvider Drops the purge by chunks from the flushAllUrls of the CloudflareProxyProvider since it can result in hundreds of purge requests to the Cloudflare API depending on the size of the project --- Classes/Provider/CloudflareProxyProvider.php | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Classes/Provider/CloudflareProxyProvider.php b/Classes/Provider/CloudflareProxyProvider.php index 8200f52..4a84634 100644 --- a/Classes/Provider/CloudflareProxyProvider.php +++ b/Classes/Provider/CloudflareProxyProvider.php @@ -92,22 +92,15 @@ public function flushAllUrls($urls = []) if (!$this->isActive()) { return; } - if (empty($urls)) { - foreach ($this->getZones() as $domain => $zoneId) { - try { - $this->getClient($zoneId)->post('purge_cache', ['json' => ['purge_everything' => true]]); - } catch (TransferException $e) { - $this->logger->error('Could not flush URLs for {zone} via POST "purge_cache"', [ - 'urls' => $urls, - 'zone' => $zoneId, - 'exception' => $e, - ]); - } - } - } else { - $groupedUrls = $this->groupUrlsByAllowedZones($urls); - foreach ($groupedUrls as $zoneId => $urls) { - $this->purgeInChunks($zoneId, $urls); + foreach ($this->getZones() as $domain => $zoneId) { + try { + $this->getClient($zoneId)->post('purge_cache', ['json' => ['purge_everything' => true]]); + } catch (TransferException $e) { + $this->logger->error('Could not flush URLs for {zone} via POST "purge_cache"', [ + 'urls' => $urls, + 'zone' => $zoneId, + 'exception' => $e, + ]); } } }