48 'target' => $record[
'target'],
49 'port' => $record[
'port'],
50 'pri' => $record[
'pri'],
51 'weight' => $record[
'weight'],
71 foreach ( $servers as $server ) {
72 $srvsByPrio[$server[
'pri']][] = $server;
75 $min = min( array_keys( $srvsByPrio ) );
76 if ( count( $srvsByPrio[$min] ) == 1 ) {
77 return $srvsByPrio[$min][0];
80 $rand = mt_rand( 0, count( $srvsByPrio[$min] ) - 1 );
82 return $srvsByPrio[$min][$rand];
92 foreach ( $servers as $i => $srv ) {
93 if ( $srv[
'target'] === $server[
'target'] && $srv[
'port'] === $server[
'port'] ) {
94 unset( $servers[$i] );
99 return array_values( $servers );
106 return dns_get_record( $this->domain, DNS_SRV );