class ZoneSyncService (View source)

Synchronizes zone metadata between the PowerDNS API and the local zones table.

In API mode, zones created directly in PowerDNS (outside Poweradmin) won't appear in the local zones table. This service reconciles the two by:

  • Adding missing zones (present in API but not locally)
  • Removing orphaned zones (present locally but deleted from API)
  • Updating cached metadata (zone_type, zone_master) when changed

Constants

private LAST_SYNC_KEY

Methods

__construct(PDO $db, DnsBackendProvider $backendProvider, int $syncInterval = 300, LoggerInterface|null $logger = null)

No description

array|null
syncIfStale(bool $withDnssec = false)

Run sync only if enough time has passed since the last sync.

array
sync(bool $withDnssec = false)

Synchronize zones from PowerDNS API with local zones table.

Details

__construct(PDO $db, DnsBackendProvider $backendProvider, int $syncInterval = 300, LoggerInterface|null $logger = null)

No description

Parameters

PDO $db
DnsBackendProvider $backendProvider
int $syncInterval
LoggerInterface|null $logger

array|null syncIfStale(bool $withDnssec = false)

Run sync only if enough time has passed since the last sync.

Parameters

bool $withDnssec

Match the zone-list variant the caller reads next, so both share one response instead of fetching the list under two URLs

Return Value

array|null

Sync result or null if skipped

array sync(bool $withDnssec = false)

Synchronize zones from PowerDNS API with local zones table.

On success, records the completion time in the session so that an immediately following syncIfStale() call (e.g. from the redirected request after a manual sync) will skip rather than re-run the full reconciliation.

Parameters

bool $withDnssec

Return Value

array