final class ApiDomainRepository implements DomainRepositoryInterface (View source)

Domain lookups for the API backend mode, read through PowerDNS.

Methods

__construct(PDO $db, ConfigurationInterface $config, ZoneReadBackendInterface&BackendCapabilitiesInterface $backendProvider, SessionInterface $session, LoggerInterface|null $logger = null)

No description

bool
zoneIdExists(int $zid)

Check if Zone ID exists. Answered from the local database only (the domains table, or the zones table in API backend mode); PowerDNS is not asked.

string|null
getDomainNameById(int $id)

Get Domain Name by domain ID

int|null
getDomainIdByName(string $name)

Get Domain ID by name

string
getDomainType(int $id)

Get the kind of a domain. In API backend mode a zones row without a cached kind costs one round trip to PowerDNS.

string|null
getDomainMaster(int $id)

Get the master (primary) server stored for a domain, whatever its kind.

bool
domainExists(string $domain)

Check if a domain is already existing. An invalid zone name never exists.

array
getZones(string $perm, int $userid = 0, string $letterstart = 'all', int $rowstart = 0, int $rowamount = Constants::DEFAULT_MAX_ROWS, string $sortby = 'name', string $sortDirection = 'ASC', bool $excludeReverse = false, bool|null $showSerial = null, bool|null $showTemplate = null, bool $includeHealth = true, bool $includeRecordCount = true)

Get Zones

array
getZoneInfoFromId(int $zid)

Get Zone details from Zone ID

array
getZoneInfoFromIds(array $zones)

Get Zone(s) details from Zone IDs

array
listZoneNames()

Every zone as a picker entry, sorted by name, regardless of who owns it.

int
getBestMatchingZoneIdFromName(string $domain)

Get Best Matching in-addr.arpa Zone ID from Domain Name

array
findZoneIdsByNames(array $names)

Answered from zones.zone_name, which Poweradmin writes synchronously on create; zones created out-of-band in PowerDNS are absent, and those have no owner to compare.

array
findZonesUnder(string $suffix)

Zones whose name ends in ".$suffix", matched case-insensitively and ordered by name.

Details

__construct(PDO $db, ConfigurationInterface $config, ZoneReadBackendInterface&BackendCapabilitiesInterface $backendProvider, SessionInterface $session, LoggerInterface|null $logger = null)

No description

Parameters

PDO $db
ConfigurationInterface $config
ZoneReadBackendInterface&BackendCapabilitiesInterface $backendProvider
SessionInterface $session
LoggerInterface|null $logger

bool zoneIdExists(int $zid)

Check if Zone ID exists. Answered from the local database only (the domains table, or the zones table in API backend mode); PowerDNS is not asked.

Parameters

int $zid

Zone ID

Return Value

bool

Whether a local row with this id exists

string|null getDomainNameById(int $id)

Get Domain Name by domain ID

Parameters

int $id

Domain ID

Return Value

string|null

Domain name or null if not found

int|null getDomainIdByName(string $name)

Get Domain ID by name

Parameters

string $name

Domain name

Return Value

int|null

Domain ID or null if not found

string getDomainType(int $id)

Get the kind of a domain. In API backend mode a zones row without a cached kind costs one round trip to PowerDNS.

Parameters

int $id

Domain ID

Return Value

string

One of the ZoneKind values (NATIVE, MASTER, SLAVE, PRODUCER, CONSUMER); NATIVE when unknown

string|null getDomainMaster(int $id)

Get the master (primary) server stored for a domain, whatever its kind.

SLAVE and CONSUMER zones both replicate from one; callers that need SLAVE only check the type. In API backend mode a zones row without a cached kind costs one round trip to PowerDNS.

Parameters

int $id

Domain ID

Return Value

string|null

Master server or null if none is stored

bool domainExists(string $domain)

Check if a domain is already existing. An invalid zone name never exists.

Parameters

string $domain

Domain name

Return Value

bool

true if existing, false if it doesn't exist.

array getZones(string $perm, int $userid = 0, string $letterstart = 'all', int $rowstart = 0, int $rowamount = Constants::DEFAULT_MAX_ROWS, string $sortby = 'name', string $sortDirection = 'ASC', bool $excludeReverse = false, bool|null $showSerial = null, bool|null $showTemplate = null, bool $includeHealth = true, bool $includeRecordCount = true)

Get Zones

Parameters

string $perm

View Zone Permissions ['own','all','none']

int $userid

Requesting User ID

string $letterstart

Starting letters to match [default='all']

int $rowstart

Start from row in set [default=0]

int $rowamount

Max number of rows to fetch for this query when not 'all' [default=9999]

string $sortby

Column to sort results by [default='name']

string $sortDirection

Sort direction [default='ASC']

bool $excludeReverse
bool|null $showSerial
bool|null $showTemplate
bool $includeHealth
bool $includeRecordCount

Return Value

array

Keyed by zone name (empty array if none found)

array getZoneInfoFromId(int $zid)

Get Zone details from Zone ID

Parameters

int $zid

Zone ID

Return Value

array

array of zone details [type,name,master_ip,record_count], or [] when not found

array getZoneInfoFromIds(array $zones)

Get Zone(s) details from Zone IDs

Parameters

array $zones

Zone IDs

Return Value

array

array listZoneNames()

Every zone as a picker entry, sorted by name, regardless of who owns it.

Return Value

array

int getBestMatchingZoneIdFromName(string $domain)

Get Best Matching in-addr.arpa Zone ID from Domain Name

Parameters

string $domain

Domain name

Return Value

int

Zone ID

array findZoneIdsByNames(array $names)

Answered from zones.zone_name, which Poweradmin writes synchronously on create; zones created out-of-band in PowerDNS are absent, and those have no owner to compare.

Parameters

array $names

Lowercased zone names

Return Value

array

Stored zone name => zone id, for the names that exist

array findZonesUnder(string $suffix)

Zones whose name ends in ".$suffix", matched case-insensitively and ordered by name.

Parameters

string $suffix

Lowercased zone name without a trailing dot

Return Value

array