mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: make isEnabled() more accurate
This commit is contained in:
parent
b2494970c7
commit
911f6e7ec2
1 changed files with 12 additions and 5 deletions
|
|
@ -39,13 +39,20 @@ class HAProxy extends BaseModel
|
|||
{
|
||||
/**
|
||||
* check if module is enabled
|
||||
* @return bool is the HAProxy enabled (1 or more active frontends)
|
||||
* @param $checkFrontends bool enable in-depth check (1 or more active frontends)
|
||||
* @return bool is the HAProxy service enabled
|
||||
*/
|
||||
public function isEnabled()
|
||||
public function isEnabled($checkFrontends=true)
|
||||
{
|
||||
foreach ($this->frontends->frontend->__items as $frontend) {
|
||||
if ((string)$frontend->enabled == "1") {
|
||||
return true;
|
||||
if ((string)$this->general->enabled === "1") {
|
||||
if ($checkFrontends === true) {
|
||||
foreach ($this->frontends->frontend->__items as $frontend) {
|
||||
if ((string)$frontend->enabled === "1") {
|
||||
return true; // Found a active frontend
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true; // HAProxy enabled
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue