class DatabaseConsistencyService (View source)

Methods

__construct(PDO $db, ConfigurationManager $config, DnsBackendProvider|null $backendProvider = null)

No description

array
checkZonesHaveOwners(array|null $apiZones = null)

Check if all zones have an owner

array
checkSlaveZonesHaveMasters(array|null $apiZones = null)

Check if all slave zones have master IP addresses

array
checkRecordsBelongToZones()

Check if all records belong to existing zones

array
checkDuplicateSOARecords(array|null $apiZones = null)

Check for duplicate SOA records

array
checkZonesWithoutSOA(array|null $apiZones = null)

Check for zones without SOA records

array|null
runAllChecks()

Run all consistency checks.

array
checkZonesHaveCanonicalIds()

Find zones rows whose domain_id never received the zone's canonical id.

bool
fixZoneCanonicalId(int $zoneId)

Point a stranded zones row's domain_id at its own id.

array
fixAllZonesWithCanonicalIdIssue()

Repair every zone returned by checkZonesHaveCanonicalIds().

bool
fixZoneWithoutOwner(int $zoneId, int $currentUserId)

Fix zone without owner by assigning the current user as owner

array
fixAllZonesWithoutOwner(int $currentUserId)

Assign the current user as owner to every zone returned by checkZonesHaveOwners().

bool
deleteSlaveZone(int $zoneId)

Delete a slave zone

bool
deleteOrphanedRecord(int $recordId)

Delete an orphaned record

bool
fixDuplicateSOA(int $zoneId)

Fix duplicate SOA records by keeping only the first one

bool
createDefaultSOA(int $zoneId)

Create a default SOA record for a zone

Details

__construct(PDO $db, ConfigurationManager $config, DnsBackendProvider|null $backendProvider = null)

No description

Parameters

PDO $db
ConfigurationManager $config
DnsBackendProvider|null $backendProvider

array checkZonesHaveOwners(array|null $apiZones = null)

Check if all zones have an owner

Parameters

array|null $apiZones

Return Value

array

array checkSlaveZonesHaveMasters(array|null $apiZones = null)

Check if all slave zones have master IP addresses

Parameters

array|null $apiZones

Return Value

array

array checkRecordsBelongToZones()

Check if all records belong to existing zones

Return Value

array

array checkDuplicateSOARecords(array|null $apiZones = null)

Check for duplicate SOA records

Parameters

array|null $apiZones

Return Value

array

array checkZonesWithoutSOA(array|null $apiZones = null)

Check for zones without SOA records

Parameters

array|null $apiZones

Return Value

array

array|null runAllChecks()

Run all consistency checks.

In API mode the zone list is fetched once and reused across every check, so a single transient failure can't make one check pass while another fails. Returns null when that fetch reveals an API outage, letting the caller surface one clear error instead of empty "all clear" results.

Return Value

array|null

array checkZonesHaveCanonicalIds()

Find zones rows whose domain_id never received the zone's canonical id.

createZone() writes the row and backfills domain_id; interrupted between the two it used to leave the row unresolvable, and nothing else repairs it.

Return Value

array

bool fixZoneCanonicalId(int $zoneId)

Point a stranded zones row's domain_id at its own id.

$zoneId is the row's primary key, not a canonical id, because the row has none yet.

Parameters

int $zoneId

The zones row ID to repair

Return Value

bool

Success status

array fixAllZonesWithCanonicalIdIssue()

Repair every zone returned by checkZonesHaveCanonicalIds().

Return Value

array

bool fixZoneWithoutOwner(int $zoneId, int $currentUserId)

Fix zone without owner by assigning the current user as owner

Parameters

int $zoneId

The zone ID to fix

int $currentUserId

The current user ID from UserContextService

Return Value

bool

Success status

array fixAllZonesWithoutOwner(int $currentUserId)

Assign the current user as owner to every zone returned by checkZonesHaveOwners().

Parameters

int $currentUserId

The current user ID from UserContextService

Return Value

array

bool deleteSlaveZone(int $zoneId)

Delete a slave zone

Parameters

int $zoneId

The zone ID to delete

Return Value

bool

Success status

bool deleteOrphanedRecord(int $recordId)

Delete an orphaned record

Parameters

int $recordId

The record ID to delete

Return Value

bool

Success status

bool fixDuplicateSOA(int $zoneId)

Fix duplicate SOA records by keeping only the first one

Parameters

int $zoneId

The zone ID with duplicate SOA records

Return Value

bool

Success status

bool createDefaultSOA(int $zoneId)

Create a default SOA record for a zone

Parameters

int $zoneId

The zone ID to create SOA for

Return Value

bool

Success status