ApiConsistencyChecks
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
No description
Assign $currentUserId as the owner of a zone that has none.
Read from the PowerDNS zone list once per run, since "fix all" repairs zone after zone.
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.
Apply a check type's bulk repair to every finding; only the two zone checks offer one.
One finding per zone name used by more than one zone in different letter case.
No description
No description
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.
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.
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.
Records sit behind the PowerDNS API in this mode, which this check cannot read or rewrite.
Lowercase the record's name, and the name of the comments on its RRset.
No description
No description
PowerDNS owns record-zone integrity in API mode, so orphaned records cannot exist.
No description
No description
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.
Point a stranded zones row's domain_id at its own id; $zoneId is the row's primary key.
The zone sync names every zone it keeps, so API mode has nothing to report.
Give the zone a zones row carrying its PowerDNS name; $zoneId is the domains.id.
New zones never take an id an API key restriction names (CanonicalZoneIdAllocator), so API mode has nothing to report.
Point the API key restrictions on $zoneId, which no zone has, at no zone.
No description
No description
No description
Deletes the DNS zone first so the ownership rows survive a failed API call.
No description
Keep the first SOA record of the zone and delete the rest.
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
bool
fixZoneWithoutOwner(int $zoneId, int $currentUserId)
Assign $currentUserId as the owner of a zone that has none.
protected 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.
protected 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
fixAllApiKeyScopesOnMissingZones()
No description
array
fixAllZonesWithoutName()
No description
array
fixAllZonesWithCanonicalIdIssue()
No description
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