Skip to content

Commit

Permalink
Fix an issue in verifying collection URL
Browse files Browse the repository at this point in the history
  • Loading branch information
bafi committed Jul 29, 2024
1 parent 2e1da6b commit f4b6179
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,19 @@ private function addHooks(): void
*/
public function verifyCollectionUrl()
{
$manager = new PccSyncManager();
if (!$manager->isPCCConfigured()) {
$manager->disconnect();
$accessToken = $this->getAccessToken();
$siteId = $this->getSiteId();
$encodedSiteURL = get_option(PCC_ENCODED_SITE_URL_OPTION_KEY);
$apiKey = $this->getAPIAccessKey();

if (!$accessToken || !$siteId || !$apiKey || !$encodedSiteURL) {
return;
}

$currentHashedSiteURL = md5(wp_parse_url(site_url())['host']);
// if both are not equal then disconnect
if ($encodedSiteURL !== $currentHashedSiteURL) {
(new PccSyncManager())->disconnect();
}
}

Expand Down

0 comments on commit f4b6179

Please sign in to comment.