SqlZoneNames
final class SqlZoneNames (View source)
Keeps one zones row per zone named after its PowerDNS domain under the SQL backend.
The SQL backend reads names from domains and does not need zones.zone_name, but a later switch to the API backend finds zones only by that name: an unnamed zone would come back as a new, ownerless row. One row carries the name, because the zone_name index is unique and a zone has one row per owner. Type and master are left to the API sync, which reads them fresh.
Methods
After an owner row is deleted: keep the zone named, and keep an ownerless named row while group grants or API key restrictions still use the zone's id, as a zone created for groups only has. Without it a switch to the API backend gives the zone a new id.
Make one of the zone's rows carry its exact PowerDNS name, correcting a stale name.
Details
static void
ensureNamedAfterOwnerRemoval(PDO $db, string $domainsTable, int $domainId)
After an owner row is deleted: keep the zone named, and keep an ownerless named row while group grants or API key restrictions still use the zone's id, as a zone created for groups only has. Without it a switch to the API backend gives the zone a new id.
static void
ensureNamed(PDO $db, string $domainsTable, int $domainId, bool $createRow = false)
Make one of the zone's rows carry its exact PowerDNS name, correcting a stale name.