From 1cca3e072429e82dc10962080670cb215726e638 Mon Sep 17 00:00:00 2001 From: Lemoine Date: Thu, 23 Aug 2018 14:54:21 +0200 Subject: [PATCH 1/2] fix: Cloudflare Api doesn't like empty tags --- src/Endpoints/Zones.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index db8f8232..432402d9 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -164,10 +164,14 @@ public function cachePurge(string $zoneID, array $files = null, array $tags = nu throw new EndpointException('No files or tags to purge.'); } - $options = [ - 'files' => $files, - 'tags' => $tags - ]; + $options = []; + if (!is_null($files)) { + $options['files'] = $files; + } + + if (!is_null($tags)) { + $options['tags'] = $tags; + } $user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options); From deb420d0879efe325c72a20e513a6384ea9fd8c7 Mon Sep 17 00:00:00 2001 From: Junade Date: Tue, 28 Aug 2018 14:58:25 +0100 Subject: [PATCH 2/2] Update Zones.php --- src/Endpoints/Zones.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index 323f2029..f0e77779 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -174,7 +174,7 @@ public function cachePurge(string $zoneID, array $files = null, array $tags = nu } if (!is_null($hosts)) { - $options['tags'] = $tags; + $options['hosts'] = $hosts; } $user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);