system: moved ISC DHCP plugin registrations to new home

This commit is contained in:
Franco Fichtner 2026-04-22 08:04:23 +02:00
parent dfdadb6274
commit 4a94e60a42

View file

@ -228,71 +228,6 @@ class MenuSystem
$cls->newInstance($this)->collect();
}
}
/* XXX: move to ISC plugin */
if (!file_exists('/usr/local/www/services_dhcp.php') && !file_exists('/usr/local/www/services_dhcpv6.php')) {
return;
}
$config = Config::getInstance()->object();
// collect interfaces for dynamic (interface) menu tabs...
$iftargets = ['dhcp4' => [], 'dhcp6' => []];
if ($config->interfaces->count() > 0) {
foreach ($config->interfaces->children() as $key => $node) {
// "Services: DHCPv[46]" menu tab:
if (empty($node->virtual) && isset($node->enable)) {
if (!empty(filter_var($node->ipaddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))) {
$iftargets['dhcp4'][$key] = !empty($node->descr) ? (string)$node->descr : strtoupper($key);
}
if (!empty(filter_var($node->ipaddrv6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) || (string)$node->ipaddrv6 == 'track6' || (string)$node->ipaddrv6 == 'idassoc6') {
$iftargets['dhcp6'][$key] = !empty($node->descr) ? (string)$node->descr : strtoupper($key);
}
}
}
}
foreach (array_keys($iftargets) as $tab) {
natcasesort($iftargets[$tab]);
}
// add interfaces to "Services: DHCPv[46]" menu tab:
$ordid = 0;
foreach ($iftargets['dhcp4'] as $key => $descr) {
$this->appendItem('Services.ISC_DHCPv4', $key, [
'url' => '/services_dhcp.php?if=' . $key,
'fixedname' => "[$descr]",
'order' => $ordid++,
]);
$this->appendItem('Services.ISC_DHCPv4.' . $key, 'Edit' . $key, [
'url' => '/services_dhcp.php?if=' . $key . '&*',
'visibility' => 'hidden',
]);
$this->appendItem('Services.ISC_DHCPv4.' . $key, 'AddStatic' . $key, [
'url' => '/services_dhcp_edit.php?if=' . $key,
'visibility' => 'hidden',
]);
$this->appendItem('Services.ISC_DHCPv4.' . $key, 'EditStatic' . $key, [
'url' => '/services_dhcp_edit.php?if=' . $key . '&*',
'visibility' => 'hidden',
]);
}
$ordid = 0;
foreach ($iftargets['dhcp6'] as $key => $descr) {
$this->appendItem('Services.ISC_DHCPv6', $key, [
'url' => '/services_dhcpv6.php?if=' . $key,
'fixedname' => "[$descr]",
'order' => $ordid++,
]);
$this->appendItem('Services.ISC_DHCPv6.' . $key, 'Add' . $key, [
'url' => '/services_dhcpv6_edit.php?if=' . $key,
'visibility' => 'hidden',
]);
$this->appendItem('Services.ISC_DHCPv6.' . $key, 'Edit' . $key, [
'url' => '/services_dhcpv6_edit.php?if=' . $key . '&*',
'visibility' => 'hidden',
]);
}
}
/**