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

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.

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.

Parameters

PDO $db
string $domainsTable
int $domainId

Return Value

void

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.

Parameters

PDO $db
string $domainsTable

The PowerDNS domains table, prefixed when pdns_db_name is set

int $domainId
bool $createRow

Add an ownerless row for a zone that has none, so grants keyed by its id survive a switch to the API backend

Return Value

void