class ReverseTtlResolver (View source)

Resolves the default TTL for new records.

Fallback chain (first non-null wins):

  1. record_type_defaults row for the submitted type (admin-managed via UI)
  2. dns.ttl_reverse (legacy config, only when the record is a PTR in a reverse zone)
  3. dns.ttl (universal fallback)

Methods

__construct(ConfigurationManager $config, RecordTypeDefaultRepositoryInterface $recordTypeDefaults)

No description

int
getDefaultTtl(bool $isReverseZone)

Default TTL for a new record on the add/edit form when the record type is not yet known (only the zone is). Reverse-zone forms default to PTR, so we consult the same fallback chain as resolveTtlForType('PTR', true).

int
getForwardTtl()

Plain dns.ttl with the 86400 fallback used by the historical batch-PTR flow when settings.defaults.php is bypassed.

int
resolvePtrTtl(int $forwardTtl)

TTL for a PTR that is auto-created alongside a forward record.

int
resolveTtlForType(string $recordType, bool $isInReverseZone)

TTL for a record about to be persisted. Checks the admin-managed record_type_defaults table first, then the legacy PTR/reverse-zone config fallback, then dns.ttl. The zone-type gate prevents PTRs that legitimately live in forward zones (RFC 2317, custom dns.domain_record_types) from picking up the reverse-zone-only legacy default.

int|null
getConfiguredReverseTtl()

The configured dns.ttl_reverse value, or null when unset/empty.

array
getTypeDefaults()

Admin-configured per-type defaults keyed by uppercase record type.

Details

__construct(ConfigurationManager $config, RecordTypeDefaultRepositoryInterface $recordTypeDefaults)

No description

Parameters

ConfigurationManager $config
RecordTypeDefaultRepositoryInterface $recordTypeDefaults

int getDefaultTtl(bool $isReverseZone)

Default TTL for a new record on the add/edit form when the record type is not yet known (only the zone is). Reverse-zone forms default to PTR, so we consult the same fallback chain as resolveTtlForType('PTR', true).

Parameters

bool $isReverseZone

Return Value

int

int getForwardTtl()

Plain dns.ttl with the 86400 fallback used by the historical batch-PTR flow when settings.defaults.php is bypassed.

Return Value

int

int resolvePtrTtl(int $forwardTtl)

TTL for a PTR that is auto-created alongside a forward record.

Same fallback chain as resolveTtlForType('PTR', true), with the forward record's TTL serving as the historical last-resort default.

Parameters

int $forwardTtl

Return Value

int

int resolveTtlForType(string $recordType, bool $isInReverseZone)

TTL for a record about to be persisted. Checks the admin-managed record_type_defaults table first, then the legacy PTR/reverse-zone config fallback, then dns.ttl. The zone-type gate prevents PTRs that legitimately live in forward zones (RFC 2317, custom dns.domain_record_types) from picking up the reverse-zone-only legacy default.

Parameters

string $recordType
bool $isInReverseZone

Return Value

int

int|null getConfiguredReverseTtl()

The configured dns.ttl_reverse value, or null when unset/empty.

Callers use null to signal "preserve historical behavior".

Return Value

int|null

array getTypeDefaults()

Admin-configured per-type defaults keyed by uppercase record type.

Templates pass this to JS so type-change swaps pick the right value.

Return Value

array