interface ZoneRepositoryInterface (View source)

Zone reads and ownership writes over the zones and domains tables. Implemented once for direct SQL and once for the API backend mode, which reads zone state via PowerDNS.

Methods

array
getDistinctStartingLetters(int $userId, bool $viewOthers)

No description

array
getAllZones(int|null $offset = null, int|null $limit = null)

Get all zones with pagination

int
getZoneCount()

Get the total number of zones

array|null
getZoneById(int $zoneId)

Get a zone by ID

array|int
getReverseZones(string $permType, int $userId, string $reverseType = 'all', int $offset = 0, int $limit = 25, string $sortBy = 'name', string $sortDirection = 'ASC', bool $countOnly = false, bool $showSerial = false, bool $showTemplate = false, bool $includeHealth = true, bool $includeRecordCount = true)

Get reverse zones with efficient database-level filtering and pagination

string|null
getDomainNameById(int $zoneId)

Get domain name by ID

array
findForwardZonesByPtrRecords(array $reverseZoneIds)

Find forward zones associated with reverse zones through PTR records

array
getReverseZoneCounts(string $permType, int $userId)

Get all reverse zone counts in a single query (optimization)

bool
zoneIdExists(int $zoneId)

Check if zone exists by ID

string
getDomainType(int $zoneId)

Get domain type by zone ID

string|null
getDomainSlaveMaster(int $zoneId)

Get slave master by zone ID

string|null
getZoneComment(int $zoneId)

Get zone comment by zone ID

bool
updateZoneComment(int $zoneId, string $comment)

Update zone comment

array
getZoneOwners(int $zoneId)

Get users who own a zone

array
getOwnerIdsByZoneIds(array $zoneIds)

Direct owners of several zones in one query, for list pages.

array
getOwnedZoneIds(int $userId)

Ids of every zone the user owns directly or through a group, in the id space the zone logs and zones_groups use.

bool
addOwnerToZone(int $zoneId, int $userId)

Add owner to zone

bool
removeOwnerFromZone(int $zoneId, int $userId)

Remove owner from zone

int|null
getZoneIdByName(string $zoneName)

Get zone ID by name

array
getDomainMetadata(int $zoneId)

Get raw PowerDNS domain metadata rows for a zone.

bool
replaceDomainMetadata(int $zoneId, array $metadata)

Replace all PowerDNS domain metadata rows for a zone.

bool
updateZone(int $zoneId, array $updates)

Update zone metadata

bool
deleteZone(int $zoneId)

Delete a zone by ID

array|null
getZone(int $zoneId)

Get a zone by ID with full details

bool
isUserZoneOwner(int $zoneId, int $userId)

Check if user is already an owner of the zone

array
listZones(int|null $userId = null, bool $viewOthers = false, array $filters = [], int $offset = 0, int $limit = 100)

List zones with optional user/permission filtering

bool
zoneExists(int $zoneId, int|null $userId = null)

Check if a zone exists, optionally for a specific user

array|null
getZoneByName(string $zoneName)

Get a zone by name

int
getZoneCountFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null)

Get count of zones with filtering

array
getAllZonesFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null, int|null $offset = null, int|null $limit = null)

Get all zones with filtering and pagination

Details

array getDistinctStartingLetters(int $userId, bool $viewOthers)

No description

Parameters

int $userId
bool $viewOthers

Return Value

array

array getAllZones(int|null $offset = null, int|null $limit = null)

Get all zones with pagination

Parameters

int|null $offset

Pagination offset

int|null $limit

Maximum number of records to return

Return Value

array

Array of zones

int getZoneCount()

Get the total number of zones

Return Value

int

Total number of zones

array|null getZoneById(int $zoneId)

Get a zone by ID

Parameters

int $zoneId

Zone ID

Return Value

array|null

Zone data if found, null otherwise

array|int getReverseZones(string $permType, int $userId, string $reverseType = 'all', int $offset = 0, int $limit = 25, string $sortBy = 'name', string $sortDirection = 'ASC', bool $countOnly = false, bool $showSerial = false, bool $showTemplate = false, bool $includeHealth = true, bool $includeRecordCount = true)

Get reverse zones with efficient database-level filtering and pagination

Parameters

string $permType

Permission type ('all', 'own')

int $userId

User ID (used when permType is 'own')

string $reverseType

Filter by reverse zone type ('all', 'ipv4', 'ipv6')

int $offset

Pagination offset

int $limit

Maximum number of records to return

string $sortBy

Column to sort by

string $sortDirection

Sort direction ('ASC' or 'DESC')

bool $countOnly

If true, returns only the count of matching zones

bool $showSerial
bool $showTemplate
bool $includeHealth
bool $includeRecordCount

Return Value

array|int

Array of reverse zones or count if countOnly is true

string|null getDomainNameById(int $zoneId)

Get domain name by ID

Parameters

int $zoneId

The zone ID

Return Value

string|null

The domain name or null if not found

array findForwardZonesByPtrRecords(array $reverseZoneIds)

Find forward zones associated with reverse zones through PTR records

Parameters

array $reverseZoneIds

Array of reverse zone IDs

Return Value

array

Array of PTR record matches with forward zone information

array getReverseZoneCounts(string $permType, int $userId)

Get all reverse zone counts in a single query (optimization)

Parameters

string $permType

Permission type ('all', 'own')

int $userId

User ID (used when permType is 'own')

Return Value

array

bool zoneIdExists(int $zoneId)

Check if zone exists by ID

Parameters

int $zoneId

The zone ID

Return Value

bool

True if zone exists

string getDomainType(int $zoneId)

Get domain type by zone ID

Parameters

int $zoneId

The zone ID

Return Value

string

The domain type (MASTER, SLAVE, NATIVE)

string|null getDomainSlaveMaster(int $zoneId)

Get slave master by zone ID

Parameters

int $zoneId

The zone ID

Return Value

string|null

The slave master or null if not found

string|null getZoneComment(int $zoneId)

Get zone comment by zone ID

Parameters

int $zoneId

The zone ID

Return Value

string|null

The zone comment or null if not found

bool updateZoneComment(int $zoneId, string $comment)

Update zone comment

Parameters

int $zoneId

The zone ID

string $comment

The new comment

Return Value

bool

True if updated successfully

array getZoneOwners(int $zoneId)

Get users who own a zone

Parameters

int $zoneId

The zone ID

Return Value

array

Array of user information

array getOwnerIdsByZoneIds(array $zoneIds)

Direct owners of several zones in one query, for list pages.

Parameters

array $zoneIds

Return Value

array

Zone id => owner user ids; zones without a row are absent

array getOwnedZoneIds(int $userId)

Ids of every zone the user owns directly or through a group, in the id space the zone logs and zones_groups use.

Parameters

int $userId

Return Value

array

bool addOwnerToZone(int $zoneId, int $userId)

Add owner to zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if added successfully

bool removeOwnerFromZone(int $zoneId, int $userId)

Remove owner from zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if removed successfully

int|null getZoneIdByName(string $zoneName)

Get zone ID by name

Parameters

string $zoneName

The zone name

Return Value

int|null

The zone ID or null if not found

array getDomainMetadata(int $zoneId)

Get raw PowerDNS domain metadata rows for a zone.

Parameters

int $zoneId

The zone ID

Return Value

array

Array of metadata rows [['kind' => string, 'content' => string], ...]

bool replaceDomainMetadata(int $zoneId, array $metadata)

Replace all PowerDNS domain metadata rows for a zone.

Parameters

int $zoneId

The zone ID

array $metadata

Array of metadata rows [['kind' => string, 'content' => string], ...]

Return Value

bool

True if metadata was replaced successfully

bool updateZone(int $zoneId, array $updates)

Update zone metadata

Parameters

int $zoneId

The zone ID

array $updates

Array of field => value pairs to update

Return Value

bool

True if zone was updated successfully

bool deleteZone(int $zoneId)

Delete a zone by ID

Parameters

int $zoneId

The zone ID

Return Value

bool

True if zone was deleted successfully

array|null getZone(int $zoneId)

Get a zone by ID with full details

Parameters

int $zoneId

The zone ID

Return Value

array|null

The zone data or null if not found

bool isUserZoneOwner(int $zoneId, int $userId)

Check if user is already an owner of the zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if user is already an owner

array listZones(int|null $userId = null, bool $viewOthers = false, array $filters = [], int $offset = 0, int $limit = 100)

List zones with optional user/permission filtering

Parameters

int|null $userId

Optional user ID for filtering

bool $viewOthers

Whether user can view other users' zones

array $filters

Optional filters

int $offset

Pagination offset

int $limit

Maximum number of records

Return Value

array

Array of zones

bool zoneExists(int $zoneId, int|null $userId = null)

Check if a zone exists, optionally for a specific user

Parameters

int $zoneId

The zone ID

int|null $userId

Optional user ID

Return Value

bool

True if zone exists

array|null getZoneByName(string $zoneName)

Get a zone by name

Parameters

string $zoneName

The zone name

Return Value

array|null

Zone data if found, null otherwise

int getZoneCountFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null)

Get count of zones with filtering

Parameters

array|null $zoneIds

Optional array of zone IDs to filter

int|null $userId

Optional user ID filter

string|null $nameFilter

Optional name filter

Return Value

int

Number of matching zones

array getAllZonesFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null, int|null $offset = null, int|null $limit = null)

Get all zones with filtering and pagination

Parameters

array|null $zoneIds

Optional array of zone IDs to filter

int|null $userId

Optional user ID filter

string|null $nameFilter

Optional name filter

int|null $offset

Optional pagination offset

int|null $limit

Optional pagination limit

Return Value

array

Array of matching zones