Add DNS monitoring and refresh functionality

Introduce DNS monitoring: add DnsService (comprehensive DNS lookup, crt.sh discovery, Cloudflare detection, IP enrichment) and a new DnsRecord model to persist snapshots, manage diffs, and provide queries/stats. Update DomainController to support a dns_monitoring_enabled flag, refactor WHOIS/DNS refresh logic into performWhoisRefresh/performDnsRefresh, and add endpoints for refreshWhois, refreshDns and refreshAll; send notifications when DNS monitoring is toggled. Add UI templates/tabs for DNS, billing, notifications, overview, SSL and WHOIS and wire DNS data into the domain view; expose cached IP details. Add cron/check_dns.php and migration 027_add_dns_monitoring.sql (and include it in installer migration lists). Other tweaks: safer EmailHelper subject handling, TldRegistry search improvements, domain sorting using an effective status (expiring_soon), Discord channel null-safe fields, settings UI additions (domain_view_template and cron staleness warnings), and route/migration updates. This enables scheduled and manual DNS scans with persistent records and notifications.
This commit is contained in:
Hosteroid
2026-03-08 14:32:05 +02:00
parent db094d6d8b
commit 8559e903b9
29 changed files with 4493 additions and 100 deletions

View File

@@ -114,13 +114,14 @@ class TldRegistry extends Model
*/
public function search(string $search): array
{
$search = '%' . $search . '%';
$tldNorm = strtolower(trim(trim($search), '.'));
$suffix = '%.' . $tldNorm;
$sql = "SELECT * FROM tld_registry
WHERE (LOWER(tld) LIKE LOWER(?) OR LOWER(whois_server) LIKE LOWER(?) OR LOWER(registry_url) LIKE LOWER(?))
WHERE (LOWER(TRIM(BOTH '.' FROM tld)) = ? OR LOWER(tld) LIKE ?)
ORDER BY tld ASC";
$stmt = $this->db->prepare($sql);
$stmt->execute([$search, $search, $search]);
$stmt->execute([$tldNorm, $suffix]);
return $stmt->fetchAll();
}
@@ -144,11 +145,12 @@ class TldRegistry extends Model
$whereConditions = [];
$params = [];
// Search filter
// Search filter: exact match OR TLDs ending with .{search} (e.g. "za" -> .za, .co.za, .net.za)
if (!empty($search)) {
$searchParam = '%' . $search . '%';
$whereConditions[] = "(LOWER(tld) LIKE LOWER(?) OR LOWER(whois_server) LIKE LOWER(?) OR LOWER(registry_url) LIKE LOWER(?))";
$params = array_merge($params, [$searchParam, $searchParam, $searchParam]);
$tldNorm = strtolower(trim(trim($search), '.'));
$suffix = '%.' . $tldNorm;
$whereConditions[] = "(LOWER(TRIM(BOTH '.' FROM tld)) = ? OR LOWER(tld) LIKE ?)";
$params = array_merge($params, [$tldNorm, $suffix]);
}
// Status filter