diff --git a/app/Domain.php b/app/Domain.php index 246fe48..6c27afd 100644 --- a/app/Domain.php +++ b/app/Domain.php @@ -597,7 +597,12 @@ public function set_nameservers( $nameservers = [] ) { public static function zone( $domain_id ) { $domain = ( new Domains )->get( $domain_id ); $domain_info = Remote\Constellix::get( "domains/$domain->remote_id" ); - $records = Remote\Constellix::get( "domains/$domain->remote_id/records" ); + $records = Remote\Constellix::get( "domains/$domain->remote_id/records", [ "perPage" => 100 ] ); + $steps = ceil( $records->meta->pagination->total / 100 ); + for ($i = 1; $i < $steps; $i++) { + $additional_records = Remote\Constellix::get( "domains/$domain->remote_id/records", [ "page" => $i + 1, "perPage" => 100 ] ); + $records->data = array_merge($records->data, $additional_records->data); + } $zone = new \Badcow\DNS\Zone( $domain->name .'.'); $zone->setDefaultTtl(3600); $zone_record = new \Badcow\DNS\ResourceRecord; diff --git a/captaincore.php b/captaincore.php index 2a43683..b98d644 100755 --- a/captaincore.php +++ b/captaincore.php @@ -859,14 +859,20 @@ function captaincore_dns_func( $request ) { } $remote_id = ( new CaptainCore\Domains )->get( $domain_id )->remote_id; - $domain = CaptainCore\Remote\Constellix::get( "domains/$remote_id" ); - $response = CaptainCore\Remote\Constellix::get( "domains/$remote_id/records?perPage=100" ); - if ( ! $response->errors ) { - array_multisort( array_column( $response->data, 'type' ), SORT_ASC, array_column( $response->data, 'name' ), SORT_ASC, $response->data ); + $domain = CaptainCore\Remote\Constellix::get( "domains/$remote_id" ); + $records = CaptainCore\Remote\Constellix::get( "domains/$remote_id/records?perPage=100" ); + $steps = ceil( $records->meta->pagination->total / 100 ); + for ($i = 1; $i < $steps; $i++) { + $additional_records = CaptainCore\Remote\Constellix::get( "domains/$remote_id/records", [ "page" => $i + 1, "perPage" => 100 ] ); + $records->data = array_merge($records->data, $additional_records->data); + } + + if ( ! $records->errors ) { + array_multisort( array_column( $records->data, 'type' ), SORT_ASC, array_column( $records->data, 'name' ), SORT_ASC, $records->data ); } return [ - "records" => $response->data, + "records" => $records->data, "nameservers" => $domain->data->nameservers ]; }