diff options
author | doktornotor <notordoktor@gmail.com> | 2015-09-30 16:19:25 +0200 |
---|---|---|
committer | doktornotor <notordoktor@gmail.com> | 2015-09-30 16:19:25 +0200 |
commit | 109b1e565344581ebecfbefed8e482b1ebc48f37 (patch) | |
tree | eea9d42365e0a44f4f1f9567ec8330602e2380ec /config/squid3 | |
parent | 6239f50ae4a51f1f3fc99d48a62efc9c6f528ace (diff) | |
download | pfsense-packages-109b1e565344581ebecfbefed8e482b1ebc48f37.tar.gz pfsense-packages-109b1e565344581ebecfbefed8e482b1ebc48f37.tar.bz2 pfsense-packages-109b1e565344581ebecfbefed8e482b1ebc48f37.zip |
If cache dir is located outside of /var/squid hierarchy, log some instructions and return
Diffstat (limited to 'config/squid3')
-rw-r--r-- | config/squid3/34/swapstate_check.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/squid3/34/swapstate_check.php b/config/squid3/34/swapstate_check.php index 8b4c46bb..b144f6d8 100644 --- a/config/squid3/34/swapstate_check.php +++ b/config/squid3/34/swapstate_check.php @@ -36,12 +36,19 @@ global $config; $settings = $config['installedpackages']['squidcache']['config'][0]; // Only check the cache if Squid is actually caching. // If there is no cache then quietly do nothing. +// If cache dir is located outside of /var/squid hierarchy, log some instructions. if (isset($settings['harddisk_cache_system']) && $settings['harddisk_cache_system'] != "null") { $cachedir = ($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); $swapstate = $cachedir . '/swap.state'; if (!file_exists($swapstate)) { return; } + if (substr($cachedir, 0, 11) !== "/var/squid/") { + log_error("swapstate_check.php will NOT manage Squid cache dir '{$cachedir}' since it is not located under /var/squid."); + log_error("Disable 'Clear Cache on Log Rotate' on the 'Local Cache' tab or relocate your cache dir under /var/squid."); + return; + } + $disktotal = disk_total_space(dirname($cachedir)); $diskfree = disk_free_space(dirname($cachedir)); $diskusedpct = round((($disktotal - $diskfree) / $disktotal) * 100); |