Skip to main content

LicenseValidationCron

Daily WP-Cron job on the benecaster_license_validation hook. Validates every connected show against the license server, records telemetry, and updates the plugin’s licence state options. run() is also called synchronously by POST /license/validate when an admin triggers an immediate validation cycle.

Validation is per show. run() reads the connected show UUIDs from ShowTokenRepository; if none is connected it fires benecaster_license_cron_complete and returns without any network call. Each connected show is validated in turn and carries its own 401 strike counter and reconnect flag, so a revoked token on one show does not lock out another.

Response handling — status: valid maps to Active or Expiring depending on expires_at and resets the failure counter; status: invalid maps to Cancelled (reason: cancelled) or Suspended and also resets the counter, because the server was reachable; a null or malformed response fails open, leaving current state and incrementing the consecutive-failure counter.

Failure thresholds — days 1 to 14 are silent. Days 15 to 29 carry a 1-in-10 daily chance of dispatching the operator alert. Day 30 and beyond forces status to Expired, restricting premium features until the server is reachable again.