diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-08 08:36:34 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-08 08:36:34 -0300 |
commit | 837033d94cc3cc39a1777258c0cf412dc3b34161 (patch) | |
tree | fbe89aff4082df9d8df08e1005b6c058bbbb2b9a | |
parent | 7e2d86616bf964147b9759f75eae62f7815413ca (diff) | |
parent | 9d3aa2a4375af058e48493300d09bc1f89eec14d (diff) | |
download | pfsense-packages-837033d94cc3cc39a1777258c0cf412dc3b34161.tar.gz pfsense-packages-837033d94cc3cc39a1777258c0cf412dc3b34161.tar.bz2 pfsense-packages-837033d94cc3cc39a1777258c0cf412dc3b34161.zip |
Merge pull request #1050 from doktornotor/patch-22
-rw-r--r-- | config/squid/squid.inc | 86 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 |
2 files changed, 19 insertions, 69 deletions
diff --git a/config/squid/squid.inc b/config/squid/squid.inc index 8e87c7a1..48a92a75 100644 --- a/config/squid/squid.inc +++ b/config/squid/squid.inc @@ -541,78 +541,28 @@ function squid_validate_auth($post, &$input_errors) { } function squid_install_cron($should_install) { - global $config, $g; - if($g['booting']==true) - return; - $rotate_is_installed = false; - $swapstate_is_installed = false; - if(!$config['cron']['item']) + global $config; + if (platform_booting()) { return; - $settings = $config['installedpackages']['squidcache']['config'][0]; + } + parse_config(true); - $x=0; - $rotate_job_id=-1; - $swapstate_job_id=-1; + if (is_array($config['installedpackages']['squidcache'])) { + $settings = $config['installedpackages']['squidcache']['config'][0]; + } else { + $settings = array(); + } + $cachedir = ($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); + $cron_cmd = "/bin/rm {$cachedir}/swap.state; " . SQUID_LOCALBASE . "/sbin/squid -k rotate"; + $swapstate_cmd = "/usr/local/pkg/swapstate_check.php"; - foreach($config['cron']['item'] as $item) { - if(strstr($item['task_name'], "squid_rotate_logs")) { - $rotate_job_id = $x; - } elseif(strstr($item['task_name'], "squid_check_swapstate")) { - $swapstate_job_id = $x; - } - $x++; - } - $need_write = false; - switch($should_install) { - case true: - $cachedir =($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); - if($rotate_job_id < 0) { - $cron_item = array(); - $cron_item['task_name'] = "squid_rotate_logs"; - $cron_item['minute'] = "0"; - $cron_item['hour'] = "0"; - $cron_item['mday'] = "*"; - $cron_item['month'] = "*"; - $cron_item['wday'] = "*"; - $cron_item['who'] = "root"; - $cron_item['command'] = "/bin/rm {$cachedir}/swap.state; " . SQUID_LOCALBASE . "/sbin/squid -k rotate"; - $config['cron']['item'][] = $cron_item; - $need_write = true; - } - if($swapstate_job_id < 0) { - $cron_item = array(); - $cron_item['task_name'] = "squid_check_swapstate"; - $cron_item['minute'] = "*/15"; - $cron_item['hour'] = "*"; - $cron_item['mday'] = "*"; - $cron_item['month'] = "*"; - $cron_item['wday'] = "*"; - $cron_item['who'] = "root"; - $cron_item['command'] = "/usr/local/pkg/swapstate_check.php"; - $config['cron']['item'][] = $cron_item; - $need_write = true; - } - if ($need_write) { - parse_config(true); - write_config("Adding Squid Cron Jobs"); - } - break; - case false: - if($rotate_job_id >= 0) { - unset($config['cron']['item'][$rotate_job_id]); - $need_write = true; - } - if($swapstate_job_id >= 0) { - unset($config['cron']['item'][$swapstate_job_id]); - $need_write = true; - } - if ($need_write) { - parse_config(true); - write_config("Removing Squid Cron Jobs"); - } - break; + if ($should_install) { + install_cron_job("{$cron_cmd}", true, "0", "0", "*", "*", "*", "root"); + install_cron_job("{$swapstate_cmd}", true, "*/15"); + } else { + install_cron_job("{$cron_cmd}", false); + install_cron_job("{$swapstate_cmd}", false); } - configure_cron(); } function squid_resync_general() { diff --git a/pkg_config.10.xml b/pkg_config.10.xml index ebca9f45..a95eedab 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1025,7 +1025,7 @@ <descr>High performance web proxy cache.</descr> <website>http://www.squid-cache.org/</website> <category>Network</category> - <version>2.7.9 pkg v.4.3.6</version> + <version>4.3.7</version> <status>Stable</status> <required_version>2.2</required_version> <maintainer>fernando@netfilter.com.br seth.mos@dds.nl mfuchs77@googlemail.com jimp@pfsense.org</maintainer> |