Skip to content

Commit a3a346c

Browse files
authored
Merge pull request #62 from powerkent/fix-refresh-cache
fix: Cloudflare Api doesn't like empty tags
2 parents 8df0ec5 + deb420d commit a3a346c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/Endpoints/Zones.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,18 @@ public function cachePurge(string $zoneID, array $files = null, array $tags = nu
164164
throw new EndpointException('No files, tags or hosts to purge.');
165165
}
166166

167-
$options = [
168-
'files' => $files,
169-
'tags' => $tags,
170-
'hosts' => $hosts
171-
];
167+
$options = [];
168+
if (!is_null($files)) {
169+
$options['files'] = $files;
170+
}
171+
172+
if (!is_null($tags)) {
173+
$options['tags'] = $tags;
174+
}
175+
176+
if (!is_null($hosts)) {
177+
$options['hosts'] = $hosts;
178+
}
172179

173180
$user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);
174181

0 commit comments

Comments
 (0)