class ReverseRecordCreator (View source)

Keeps PTR records in step with A/AAAA records: adds, updates and deletes the counterpart in the paired zone.

Methods

__construct(bool $reverseHandling, AuditLoggerInterface $audit, DomainRepositoryInterface $domainRepository, RecordManagerInterface $recordManager, RecordReadBackendInterface $recordBackend)

No description

array
createReverseRecord(string $name, string $type, string $content, int $zone_id, int $ttl, int $prio, string $comment = '', string $account = '', bool $finalizeZone = true, bool $audit = true, bool $validateOnly = false, Closure|null $zoneAllowed = null)

No description

string|null
getContentRev($type, $content)

No description

bool
deleteReverseRecord(string $type, string $content, string $name, Closure|null $zoneAllowed = null)

Find and delete the corresponding PTR record for a given A or AAAA record

array
updateReverseRecord(string $oldType, string $oldContent, string $oldName, string $newType, string $newContent, string $newName, int $zone_id, int $ttl, int $prio, string $comment = '', string $account = '', Closure|null $zoneAllowed = null)

Sync the PTR record after an A/AAAA forward record was edited.

bool
deleteForwardRecord(string $ptrName, string $ptrContent, Closure|null $zoneAllowed = null)

Find and delete the corresponding A or AAAA record for a given PTR record

Details

__construct(bool $reverseHandling, AuditLoggerInterface $audit, DomainRepositoryInterface $domainRepository, RecordManagerInterface $recordManager, RecordReadBackendInterface $recordBackend)

No description

Parameters

bool $reverseHandling

Whether PTR records may be created alongside A/AAAA records

AuditLoggerInterface $audit
DomainRepositoryInterface $domainRepository
RecordManagerInterface $recordManager
RecordReadBackendInterface $recordBackend

array createReverseRecord(string $name, string $type, string $content, int $zone_id, int $ttl, int $prio, string $comment = '', string $account = '', bool $finalizeZone = true, bool $audit = true, bool $validateOnly = false, Closure|null $zoneAllowed = null)

No description

Parameters

string $name

Forward record name

string $type

Forward record type, A or AAAA

string $content

Forward record address

int $zone_id

Zone holding the forward record

int $ttl

TTL for the PTR record

int $prio

Priority for the PTR record

string $comment

Record comment

string $account

Acting user name

bool $finalizeZone

False when a batch caller bumps the serial and rectifies the reverse zone itself

bool $audit

False for a dry run: nothing is written to the audit log

bool $validateOnly

True when the PTR must not be written at all, only checked

Closure|null $zoneAllowed

Whether the caller may write to the reverse zone, beyond the edit rights the record manager checks

Return Value

array

success, type and message, plus zone_id (the reverse zone written to) on success

string|null getContentRev($type, $content)

No description

Parameters

$type
$content

Return Value

string|null

bool deleteReverseRecord(string $type, string $content, string $name, Closure|null $zoneAllowed = null)

Find and delete the corresponding PTR record for a given A or AAAA record

Parameters

string $type

Record type (A or AAAA)

string $content

IP address from A/AAAA record

string $name

Hostname from A/AAAA record

Closure|null $zoneAllowed

Whether the caller may write to the zone holding the PTR

Return Value

bool

True if a matching PTR record was found and deleted

array updateReverseRecord(string $oldType, string $oldContent, string $oldName, string $newType, string $newContent, string $newName, int $zone_id, int $ttl, int $prio, string $comment = '', string $account = '', Closure|null $zoneAllowed = null)

Sync the PTR record after an A/AAAA forward record was edited.

Removes the stale PTR (best-effort; user may not have created one originally) and creates a new PTR for the updated IP and hostname. Returns success when no PTR-relevant fields changed.

Parameters

string $oldType
string $oldContent
string $oldName
string $newType
string $newContent
string $newName
int $zone_id
int $ttl
int $prio
string $comment
string $account
Closure|null $zoneAllowed

Whether the caller may write to a reverse zone; when the old or the new one is refused, neither PTR is touched

Return Value

array

bool deleteForwardRecord(string $ptrName, string $ptrContent, Closure|null $zoneAllowed = null)

Find and delete the corresponding A or AAAA record for a given PTR record

Parameters

string $ptrName

PTR record name (e.g., 1.0.168.192.in-addr.arpa)

string $ptrContent

PTR record content (hostname)

Closure|null $zoneAllowed

Whether the caller may write to the zone holding the A/AAAA record

Return Value

bool

True if a matching A/AAAA record was found and deleted