interface RecordWriteBackendInterface (View source)

Record add, edit and delete writes against the DNS backend.

Methods

bool
addRecord(int $domainId, string $name, string $type, string $content, int $ttl, int $prio)

Add a DNS record.

int|string|null
addRecordGetId(int $domainId, string $name, string $type, string $content, int $ttl, int $prio, array|null $comment = null)

Add a DNS record and return its ID.

int|string|null
createRecordAtomic(int $domainId, string $name, string $type, string $content, int $ttl, int $prio, int $disabled = 0, array|null $comment = null)

Create a DNS record atomically with optional disabled flag.

bool
editRecord(int|string $recordId, string $name, string $type, string $content, int $ttl, int $prio, int $disabled, array|null $comment = null)

Edit an existing DNS record.

bool
deleteRecord(int|string $recordId)

Delete a DNS record by ID.

bool
replaceSoaContent(int $zoneId, string $content)

Replace the content of a zone's SOA record. The SQL backend keeps the stored TTL; the API backend rewrites the whole RRset with the configured dns.ttl.

bool
rewriteSoaContent(int $zoneId, callable $change)

Rewrites the zone's SOA content from its current value as one step, so concurrent writers to the zone cannot both bump from the same serial. The SQL backend locks the SOA row for it; the API backend reads and rewrites the RRset.

Details

bool addRecord(int $domainId, string $name, string $type, string $content, int $ttl, int $prio)

Add a DNS record.

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type (A, AAAA, CNAME, MX, etc.)

string $content

Record content

int $ttl Time-to-live
int $prio Priority

Return Value

bool

int|string|null addRecordGetId(int $domainId, string $name, string $type, string $content, int $ttl, int $prio, array|null $comment = null)

Add a DNS record and return its ID.

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

string $content

Record content

int $ttl Time-to-live
int $prio Priority
array|null $comment

RRset comment ['content' => string, 'account' => string]; null leaves comments untouched. SQL mode ignores it.

Return Value

int|string|null

The new record ID (int for SQL mode, encoded string for API mode), or null on failure

int|string|null createRecordAtomic(int $domainId, string $name, string $type, string $content, int $ttl, int $prio, int $disabled = 0, array|null $comment = null)

Create a DNS record atomically with optional disabled flag.

In SQL mode, wraps the INSERT in a transaction with deadlock retry. In API mode, one RRset REPLACE carries the record and the disabled flag.

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

string $content

Record content

int $ttl Time-to-live
int $prio Priority
int $disabled

Disabled flag (0 = enabled, 1 = disabled)

array|null $comment

RRset comment as for addRecordGetId()

Return Value

int|string|null

The new record ID, or null on failure

bool editRecord(int|string $recordId, string $name, string $type, string $content, int $ttl, int $prio, int $disabled, array|null $comment = null)

Edit an existing DNS record.

Parameters

int|string $recordId

Record ID (int for SQL mode, encoded string for API mode)

string $name

New record name

string $type

New record type

string $content

New record content

int $ttl

New TTL

int $prio

New priority

int $disabled

Whether record is disabled (0 or 1)

array|null $comment

RRset comment ['content' => string, 'account' => string]; null leaves comments untouched, empty content clears them. SQL mode ignores it.

Return Value

bool

bool deleteRecord(int|string $recordId)

Delete a DNS record by ID.

Parameters

int|string $recordId

Record ID (int for SQL mode, encoded string for API mode)

Return Value

bool

bool replaceSoaContent(int $zoneId, string $content)

Replace the content of a zone's SOA record. The SQL backend keeps the stored TTL; the API backend rewrites the whole RRset with the configured dns.ttl.

Parameters

int $zoneId

Domain ID

string $content

New SOA content

Return Value

bool

True when the SOA record was rewritten

bool rewriteSoaContent(int $zoneId, callable $change)

Rewrites the zone's SOA content from its current value as one step, so concurrent writers to the zone cannot both bump from the same serial. The SQL backend locks the SOA row for it; the API backend reads and rewrites the RRset.

Parameters

int $zoneId

Domain ID

callable $change

Gets the current content, returns the new content or null to keep it

Return Value

bool

False when the zone has no SOA record or the write failed