Skip to content

Commit

Permalink
Merge pull request #62 from powerkent/fix-refresh-cache
Browse files Browse the repository at this point in the history
fix: Cloudflare Api doesn't like empty tags
  • Loading branch information
IcyApril authored Aug 28, 2018
2 parents 8df0ec5 + deb420d commit a3a346c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Endpoints/Zones.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,18 @@ public function cachePurge(string $zoneID, array $files = null, array $tags = nu
throw new EndpointException('No files, tags or hosts to purge.');
}

$options = [
'files' => $files,
'tags' => $tags,
'hosts' => $hosts
];
$options = [];
if (!is_null($files)) {
$options['files'] = $files;
}

if (!is_null($tags)) {
$options['tags'] = $tags;
}

if (!is_null($hosts)) {
$options['hosts'] = $hosts;
}

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

Expand Down

0 comments on commit a3a346c

Please sign in to comment.