final class ApiConsistencyChecks extends AbstractConsistencyChecks (View source)

Consistency checks for the API backend: zone and record state comes from the PowerDNS API, ownership from the Poweradmin-native zones tables.

Zones PowerDNS reports but Poweradmin has not synced yet carry id 0 and have no local row; every per-zone check skips them until ZoneSyncService imports them.

Methods

__construct(PDO $db, DnsBackendProviderInterface $backend, ApiStatusInterface $apiStatus, ZoneOwnerRepair $ownerRepair, DefaultSoaBuilder $defaultSoa, AccountOwnerLookup|null $accountOwners = null, LoggerInterface $logger = new NullLogger(), ZoneChangeRequestRepositoryInterface|null $changeRequests = null)

No description

bool
fixZoneWithoutOwner(int $zoneId, int $currentUserId)

Assign $currentUserId as the owner of a zone that has none.

string|null
zoneAccount(int $zoneId)

Read from the PowerDNS zone list once per run, since "fix all" repairs zone after zone.

array
fixAllZonesWithoutOwner(int $currentUserId)

No description

array
fixOne(string $type, int $id, int $currentUserId)

Apply the single-item repair for a consistency page check type (zones_without_owners, zones_without_canonical_ids, records_with_uppercase_names, slave_zones_without_masters, orphaned_records, duplicate_soa, zones_without_soa) to one finding.

array
fixAll(string $type, int $currentUserId)

Apply a check type's bulk repair to every finding; only the two zone checks offer one.

array
groupByLowerName(array $zones)

One finding per zone name used by more than one zone in different letter case.

array
checkZonesHaveOwners()

No description

array
checkZonesHaveCanonicalIds()

No description

array
checkSharedZoneIds()

Zone ids a zone created here and a migrated zone share (see SharedZoneIds). Their extra owners and group grants are ignored until the zones are separated.

array
checkGroupGrantsOnRowIds()

Group assignments made through the API before 4.6.0 hold the row id the zone list reported. Only those whose id is a migrated zone's row id and no zone's canonical id are listed: they certainly reach nothing. One that is also a canonical id cannot be told apart from a correct assignment, so it is left out.

array
checkZoneNamesDifferingInCase()

Zone names that exist more than once in different letter case, such as Example.com and example.com, which PowerDNS treats as the same name. Report only.

array
checkRecordNamesInLowercase()

Records sit behind the PowerDNS API in this mode, which this check cannot read or rewrite.

bool
fixRecordNameCase(int $recordId)

Lowercase the record's name, and the name of the comments on its RRset.

array
fixAllRecordNamesCase()

No description

array
checkSlaveZonesHaveMasters()

No description

array
checkRecordsBelongToZones()

PowerDNS owns record-zone integrity in API mode, so orphaned records cannot exist.

array
checkDuplicateSOARecords()

No description

array
checkZonesWithoutSOA()

No description

array|null
runAllChecks()

The zone list is fetched once and shared by every check, so one transient failure cannot make one check pass while another fails. The provider swallows transport errors into an empty list; an empty list paired with a recorded API error means an outage, and so does a failed per-zone record read.

bool
fixZoneCanonicalId(int $zoneId)

Point a stranded zones row's domain_id at its own id; $zoneId is the row's primary key.

array
checkZonesHaveNames()

The zone sync names every zone it keeps, so API mode has nothing to report.

bool
fixZoneName(int $zoneId)

Give the zone a zones row carrying its PowerDNS name; $zoneId is the domains.id.

array
checkApiKeyScopesNameZones()

New zones never take an id an API key restriction names (CanonicalZoneIdAllocator), so API mode has nothing to report.

bool
fixApiKeyScopesOnMissingZone(int $zoneId)

Point the API key restrictions on $zoneId, which no zone has, at no zone.

array
array
fixAllZonesWithoutName()

No description

array
bool
deleteSlaveZone(int $zoneId)

Deletes the DNS zone first so the ownership rows survive a failed API call.

bool
deleteOrphanedRecord(int $recordId)

No description

bool
fixDuplicateSOA(int $zoneId)

Keep the first SOA record of the zone and delete the rest.

bool
createDefaultSOA(int $zoneId)

No description

Details

__construct(PDO $db, DnsBackendProviderInterface $backend, ApiStatusInterface $apiStatus, ZoneOwnerRepair $ownerRepair, DefaultSoaBuilder $defaultSoa, AccountOwnerLookup|null $accountOwners = null, LoggerInterface $logger = new NullLogger(), ZoneChangeRequestRepositoryInterface|null $changeRequests = null)

No description

Parameters

PDO $db
DnsBackendProviderInterface $backend
ApiStatusInterface $apiStatus
ZoneOwnerRepair $ownerRepair
DefaultSoaBuilder $defaultSoa
AccountOwnerLookup|null $accountOwners

Prefers the user a zone's PowerDNS account names (dns.adopt_zone_owner_from_account)

LoggerInterface $logger
ZoneChangeRequestRepositoryInterface|null $changeRequests

Cancels the open change requests of a deleted slave zone

bool fixZoneWithoutOwner(int $zoneId, int $currentUserId)

Assign $currentUserId as the owner of a zone that has none.

Parameters

int $zoneId
int $currentUserId

Return Value

bool

protected string|null zoneAccount(int $zoneId)

Read from the PowerDNS zone list once per run, since "fix all" repairs zone after zone.

Parameters

int $zoneId

Return Value

string|null

array fixAllZonesWithoutOwner(int $currentUserId)

No description

Parameters

int $currentUserId

Return Value

array

array fixOne(string $type, int $id, int $currentUserId)

Apply the single-item repair for a consistency page check type (zones_without_owners, zones_without_canonical_ids, records_with_uppercase_names, slave_zones_without_masters, orphaned_records, duplicate_soa, zones_without_soa) to one finding.

Parameters

string $type
int $id
int $currentUserId

Return Value

array

status is success or error

array fixAll(string $type, int $currentUserId)

Apply a check type's bulk repair to every finding; only the two zone checks offer one.

Parameters

string $type
int $currentUserId

Return Value

array

status is success, warning or error

protected array groupByLowerName(array $zones)

One finding per zone name used by more than one zone in different letter case.

Parameters

array $zones

Return Value

array

array checkZonesHaveOwners()

No description

Return Value

array

array checkZonesHaveCanonicalIds()

No description

Return Value

array

array checkSharedZoneIds()

Zone ids a zone created here and a migrated zone share (see SharedZoneIds). Their extra owners and group grants are ignored until the zones are separated.

Return Value

array

array checkGroupGrantsOnRowIds()

Group assignments made through the API before 4.6.0 hold the row id the zone list reported. Only those whose id is a migrated zone's row id and no zone's canonical id are listed: they certainly reach nothing. One that is also a canonical id cannot be told apart from a correct assignment, so it is left out.

Return Value

array

array checkZoneNamesDifferingInCase()

Zone names that exist more than once in different letter case, such as Example.com and example.com, which PowerDNS treats as the same name. Report only.

Return Value

array

array checkRecordNamesInLowercase()

Records sit behind the PowerDNS API in this mode, which this check cannot read or rewrite.

Return Value

array

bool fixRecordNameCase(int $recordId)

Lowercase the record's name, and the name of the comments on its RRset.

Parameters

int $recordId

Return Value

bool

array fixAllRecordNamesCase()

No description

Return Value

array

array checkSlaveZonesHaveMasters()

No description

Return Value

array

array checkRecordsBelongToZones()

PowerDNS owns record-zone integrity in API mode, so orphaned records cannot exist.

Return Value

array

array checkDuplicateSOARecords()

No description

Return Value

array

array checkZonesWithoutSOA()

No description

Return Value

array

array|null runAllChecks()

The zone list is fetched once and shared by every check, so one transient failure cannot make one check pass while another fails. The provider swallows transport errors into an empty list; an empty list paired with a recorded API error means an outage, and so does a failed per-zone record read.

Return Value

array|null

bool fixZoneCanonicalId(int $zoneId)

Point a stranded zones row's domain_id at its own id; $zoneId is the row's primary key.

Parameters

int $zoneId

Return Value

bool

array checkZonesHaveNames()

The zone sync names every zone it keeps, so API mode has nothing to report.

Return Value

array

bool fixZoneName(int $zoneId)

Give the zone a zones row carrying its PowerDNS name; $zoneId is the domains.id.

Parameters

int $zoneId

Return Value

bool

array checkApiKeyScopesNameZones()

New zones never take an id an API key restriction names (CanonicalZoneIdAllocator), so API mode has nothing to report.

Return Value

array

bool fixApiKeyScopesOnMissingZone(int $zoneId)

Point the API key restrictions on $zoneId, which no zone has, at no zone.

Parameters

int $zoneId

Return Value

bool

array fixAllApiKeyScopesOnMissingZones()

No description

Return Value

array

array fixAllZonesWithoutName()

No description

Return Value

array

array fixAllZonesWithCanonicalIdIssue()

No description

Return Value

array

bool deleteSlaveZone(int $zoneId)

Deletes the DNS zone first so the ownership rows survive a failed API call.

Parameters

int $zoneId

Return Value

bool

bool deleteOrphanedRecord(int $recordId)

No description

Parameters

int $recordId

Return Value

bool

bool fixDuplicateSOA(int $zoneId)

Keep the first SOA record of the zone and delete the rest.

Parameters

int $zoneId

Return Value

bool

bool createDefaultSOA(int $zoneId)

No description

Parameters

int $zoneId

Return Value

bool