diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2006-12-20 10:23:55 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2006-12-20 10:23:55 +0000 |
commit | f157aa2db0e0d54619c636f7cf4317266ec229d2 (patch) | |
tree | c86ebd7c62613bd58a8e6d0f708ca805791dac82 /packages | |
parent | cff0699efc5b71abc5a30ec6f7a8344ccc233691 (diff) | |
download | pfsense-packages-f157aa2db0e0d54619c636f7cf4317266ec229d2.tar.gz pfsense-packages-f157aa2db0e0d54619c636f7cf4317266ec229d2.tar.bz2 pfsense-packages-f157aa2db0e0d54619c636f7cf4317266ec229d2.zip |
Rework the way we setup the squid cache directory
Diffstat (limited to 'packages')
-rw-r--r-- | packages/squid.inc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/packages/squid.inc b/packages/squid.inc index 91c4dc66..5b3b2d53 100644 --- a/packages/squid.inc +++ b/packages/squid.inc @@ -55,7 +55,20 @@ function squid_get_real_interface_address($iface) { /* setup cache */ function squid_dash_z() { - mwexec("/usr/local/sbin/squid -z"); + global $config; + $settings = $config['installedpackages']['squidcache']['config'][0]; + $cachedir =($settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache'); + + if(!is_dir($cachedir)) { + make_dirs($cachedir); + squid_chown_recursive($cachedir, 'proxy', 'proxy'); + } + + if(!is_dir($cachedir.'01/')) { + log_error("Creating squid cache dir in $cachedir"); + mwexec("/usr/local/sbin/squid -z"); + } + } function squid_chown_recursive($dir, $user, $group) { @@ -84,7 +97,7 @@ function squid_is_valid_acl($acl) { function squid_install_command() { /* create cache */ - mwexec("/usr/local/sbin/squid -z"); + squid_dash_z(); /* make sure pinger is executable */ exec("/bin/chmod a+x /usr/local/libexec/squid/pinger"); exec("/bin/rm /usr/local/etc/rc.d/squid"); @@ -734,19 +747,10 @@ function squid_resync() { squid_chown_recursive($log_dir, 'proxy', 'proxy'); } - if(!is_dir($disk_cache_location)) { - make_dirs($disk_cache_location); - squid_chown_recursive($disk_cache_location, 'proxy', 'proxy'); - } - if(!is_dir($disk_cache_location.'01/')) { - log_error($disk_cache_location." does not exist. Creating."); - mwexec("/usr/local/sbin/squid -z"); - } - + squid_dash_z(); if (!is_service_running('squid')) { log_error("Starting Squid"); - mwexec("/usr/local/sbin/squid -z"); mwexec_bg("/usr/local/sbin/squid -D"); mwexec_bg("/usr/local/etc/rc.d/proxy_monitor.sh"); } else { |