From 39ff3c94637f2d38e6b1a68104a194ee2402df30 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 28 Nov 2015 10:45:39 +0100 Subject: Add a function to check whether Squid reverse proxy is enabled To be used in squid.inc's squid_enabled() --- config/squid3/34/squid_reverse.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'config/squid3') diff --git a/config/squid3/34/squid_reverse.inc b/config/squid3/34/squid_reverse.inc index 15217a33..559c9d5b 100755 --- a/config/squid3/34/squid_reverse.inc +++ b/config/squid3/34/squid_reverse.inc @@ -327,6 +327,25 @@ function squid_refresh_crl() { } } +/* Check whether Squid reverse proxy is enabled */ +function squid_reverse_enabled() { + global $config, $reverse_proxy_enabled; + $reverse_proxy_enabled = false; + + if (is_array($config['installedpackages']['squidreversegeneral']['config'])) { + // check whether HTTP or HTTPS reverse proxy is enabled ... + if ($config['installedpackages']['squidreversegeneral']['config'][0]['reverse_http'] == "on" || + $config['installedpackages']['squidreversegeneral']['config'][0]['reverse_https'] == "on") { + // ... and has at least one reverse interface configured + if ($config['installedpackages']['squidreversegeneral']['config'][0]['reverse_interface'] != "") { + $reverse_proxy_enabled = true; + } + } + } + + return $reverse_proxy_enabled; +} + /* Migrate reverse proxy configuration from old Squid package versions */ function squid_reverse_upgrade_config() { global $config; -- cgit v1.2.3