fix: healthToken variable used before assignment

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-31 15:00:30 -05:00
parent 5b2a59972d
commit cb264fac6a
@@ -80,11 +80,19 @@ final class ContentSync extends CMSPlugin implements SubscriberInterface
return Status::KNOCKOUT;
}
$healthToken = trim($params->health_token ?? '');
if (empty($healthToken))
{
$this->logTask('Target health token not configured — cannot sync');
return Status::KNOCKOUT;
}
$this->targetUrl = $targetUrl;
$this->healthToken = $healthToken;
$errors = 0;
$synced = [];
$apiBase = $targetUrl . '/api/index.php/v1';
// Bulk-clear selected content types on target before pushing
$clearTypes = [];
@@ -109,15 +117,6 @@ final class ContentSync extends CMSPlugin implements SubscriberInterface
$clearTypes[] = 'modules';
}
$healthToken = trim($params->health_token ?? '');
if (empty($healthToken))
{
$this->logTask('Target health token not configured — cannot sync');
return Status::KNOCKOUT;
}
if (!empty($clearTypes))
{
$clearResult = $this->bulkClear($targetUrl, $healthToken, $clearTypes);