RecordManager
class RecordManager implements RecordManagerInterface (View source)
Creates, updates and deletes records for the web UI, with validation, logging and serial updates.
Constants
| private MAX_BACKEND_REASON_LENGTH |
|
| private NAME_CONTENT_TYPES |
Types whose whole content is one or more domain names |
| private NAME_TARGET_TYPES |
Types whose content ends in a domain name after numeric fields, such as the SRV weight and port |
Methods
Constructor
Content equality as the duplicate checks see it: exact, domain names compared without case as DNS does, the unquoted ech form, or the same AAAA address written another way.
Add a record
Add a record and return its ID
One line, control characters removed, capped; null when nothing is left.
The failure text with the backend's own reason appended: "Failed to add record to
DNS backend:
Whether two stored copies of a record differ in any field that PowerDNS serves.
Edit a record
Runs an edit's permission checks and validation, but not the duplicate check, and writes nothing. A save that moves several records first previews each one: only a record that passes and really moves goes into the vacated set of the real writes.
Delete a record by a given record id
What every single write ends with: bump the serial (unless told not to) and rectify. Batch callers pass finalizeZone=false to the writes and call this once when they are done; one holding a transaction bumps the serial inside it and calls this with bumpSerial=false after the commit, since PowerDNS rectifies from committed rows. $rrsetWritten is false when nothing was sent to the backend (no-op save, zone comment), so the API backend bumps the serial itself.
Edit the zone comment
Details
__construct(TransactionInterface $transaction, ConfigurationInterface $config, DnsRecordValidationServiceInterface $validationService, SOARecordManagerInterface $soaRecordManager, DomainRepositoryInterface $domainRepository, RepositoryFactoryInterface $repositoryFactory, Closure $dnssecProvider, RecordWriteBackendInterface&BackendCapabilitiesInterface $backendProvider, PermissionService $permissionService, RecordChangeWriterInterface $changeLogger, TemplateRecordLinkRepositoryInterface $templateLinks, ActorInterface $actor, LoggerInterface|null $logger = null, ZoneCacheFlusherInterface|null $zoneCacheFlusher = null)
Constructor
static bool
sameContent(string $type, string $content, string $stored)
Content equality as the duplicate checks see it: exact, domain names compared without case as DNS does, the unquoted ech form, or the same AAAA address written another way.
bool
addRecord(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio)
Add a record
This function validates it if correct it inserts it into the database.
RecordWriteResult
addRecordGetId(int $zone_id, string $name, string $type, string $content, int $ttl, mixed $prio, int $disabled = 0, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])
Add a record and return its ID
This function validates and inserts a record into the database, returning the new record's ID for use with per-record comments.
static string|null
cleanBackendReason(string $reason)
One line, control characters removed, capped; null when nothing is left.
static string
backendFailureMessage(string $message, string|null $reason)
The failure text with the backend's own reason appended: "Failed to add record to
DNS backend:
static bool
recordFieldsDiffer(array $before, array $after)
Whether two stored copies of a record differ in any field that PowerDNS serves.
RecordWriteResult
editRecord(array $record, bool $finalizeZone = true, array|null $comment = null, bool $dryRun = false, array $vacated = [])
Edit a record
This function validates it if correct it inserts it into the database.
RecordWriteResult
previewEdit(array $record)
Runs an edit's permission checks and validation, but not the duplicate check, and writes nothing. A save that moves several records first previews each one: only a record that passes and really moves goes into the vacated set of the real writes.
RecordWriteResult
deleteRecord(int|string $rid, bool $finalizeZone = true, bool $dryRun = false)
Delete a record by a given record id
void
finalizeZone(int $zoneId, bool $bumpSerial = true, bool $rrsetWritten = true)
What every single write ends with: bump the serial (unless told not to) and rectify. Batch callers pass finalizeZone=false to the writes and call this once when they are done; one holding a transaction bumps the serial inside it and calls this with bumpSerial=false after the commit, since PowerDNS rectifies from committed rows. $rrsetWritten is false when nothing was sent to the backend (no-op save, zone comment), so the API backend bumps the serial itself.
RecordWriteResult
editZoneComment(int $zone_id, string $comment)
Edit the zone comment
This function validates it if correct it inserts it into the database.