Skip to content

Commit

Permalink
CUSTESC-36595: Retrieve the Wordpress domain only from the active zone
Browse files Browse the repository at this point in the history
We recently noticed that a user got its zone incorrectly reported as
inactive by the Wordpress plugin. After some investigations, it seems
that two zones actually existed: an old purged one, and a new active
zone. To guarantee that the plugin always retrieve the active one, if
any, this commit changes the zone retrieval call to the Cloudflare API
by adding a `status=active` query parameter to the request, [as
documented here](https://developers.cloudflare.com/api/operations/zones-get).
  • Loading branch information
aseure committed Feb 9, 2024
1 parent 4d53897 commit bec6e94
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/WordPress/ClientActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ public function returnWordPressDomain()
// We tried to fetch a zone but it's possible we're using an API token,
// So try again with a zone name filtered API call
if (!$this->api->responseOk($response)) {
$zoneRequest = new Request('GET', 'zones/', array('name' => idn_to_ascii($this->wordpressAPI->getOriginalDomain(), IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46), array()));
$zoneRequest = new Request(
'GET',
'zones/',
array(
'name' => idn_to_ascii($this->wordpressAPI->getOriginalDomain(), IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46),
'status' => 'active',
),
null
);
$zoneResponse = $this->api->callAPI($zoneRequest);

return $zoneResponse;
Expand Down

0 comments on commit bec6e94

Please sign in to comment.