From 38439ef8cfaa2a778c02981c6c2e72c55a27ba7f Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 27 Apr 2011 10:43:51 -0400 Subject: Stop squid from doing a recursive chown/chgrp inside the cache folder, should speed up save/sync with a large cache. Version bump to reflect change. --- config/squid/squid.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/squid/squid.inc b/config/squid/squid.inc index 792a121f..61498294 100644 --- a/config/squid/squid.inc +++ b/config/squid/squid.inc @@ -63,7 +63,8 @@ function squid_chown_recursive($dir, $user, $group) { while (($item = readdir($handle)) !== false) { if (($item != ".") && ($item != "..")) { $path = "$dir/$item"; - if (is_dir($path)) + // Recurse unless it's the cache dir, that is slow and rarely necessary. + if (is_dir($path) && (basename($dir) != "cache")) squid_chown_recursive($path, $user, $group); elseif (is_file($path)) { chown($path, $user); @@ -98,8 +99,11 @@ function squid_dash_z() { mwexec("/usr/local/sbin/squid -z"); } - if(file_exists("/var/squid/cache/swap.state")) + if(file_exists("/var/squid/cache/swap.state")) { + chown("/var/squid/cache/swap.state", "proxy"); + chgrp("/var/squid/cache/swap.state", "proxy"); exec("chmod a+rw /var/squid/cache/swap.state"); + } } -- cgit v1.2.3