ReverseTtlResolver
class ReverseTtlResolver (View source)
Resolves the default TTL for new records.
Fallback chain (first non-null wins):
- record_type_defaults row for the submitted type (admin-managed via UI)
- dns.ttl_reverse (legacy config, only when the record is a PTR in a reverse zone)
- dns.ttl (universal fallback)
Methods
No description
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).
Plain dns.ttl with the 86400 fallback used by the historical batch-PTR flow when settings.defaults.php is bypassed.
TTL for a PTR that is auto-created alongside a forward record.
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.
The TTL each offered record type starts with, resolved with the same precedence as resolveTtlForType() so the form's type swap matches what the server would apply.
The same map as resolveTtlsForTypes(), computed from already-read values so a presenter can build it without the repository.
The configured dns.ttl_reverse value, or null when unset/empty.
Admin-configured per-type defaults keyed by uppercase record type.
Details
__construct(ConfigurationInterface $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.
Same fallback chain as resolveTtlForType('PTR', true), with the forward record's TTL serving as the historical last-resort default.
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.
array
resolveTtlsForTypes(array $recordTypes, bool $isInReverseZone)
The TTL each offered record type starts with, resolved with the same precedence as resolveTtlForType() so the form's type swap matches what the server would apply.
static array
ttlsForTypes(array $recordTypes, array $typeDefaults, int $forwardTtl, int|null $reverseTtl, bool $isInReverseZone)
The same map as resolveTtlsForTypes(), computed from already-read values so a presenter can build it without the repository.
int|null
getConfiguredReverseTtl()
The configured dns.ttl_reverse value, or null when unset/empty.
Callers use null to signal "preserve historical behavior".
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.