aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid-reverse
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-05-02 19:08:05 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-05-02 19:08:05 -0300
commit5f2c48fd8487d5fd1d8cd6445007900e3d4042df (patch)
tree61dfcb54927addaee6d607be15c0dc178c6b7086 /config/squid-reverse
parentb18a68f5add6ca6af5fb2f96732adf264e6c09f4 (diff)
downloadpfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.tar.gz
pfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.tar.bz2
pfsense-packages-5f2c48fd8487d5fd1d8cd6445007900e3d4042df.zip
squid3 - reduce squid startup time and include boot process check
Diffstat (limited to 'config/squid-reverse')
-rw-r--r--config/squid-reverse/squid.inc50
1 files changed, 33 insertions, 17 deletions
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc
index 16bf4bbb..073468e5 100644
--- a/config/squid-reverse/squid.inc
+++ b/config/squid-reverse/squid.inc
@@ -1331,6 +1331,15 @@ function squid_resync_msnt() {
function squid_resync() {
global $config;
+
+ # detect boot process
+ if (is_array($_POST)){
+ if (preg_match("/\w+/",$_POST['__csrf_magic']))
+ unset($boot_process);
+ else
+ $boot_process="on";
+ }
+
conf_mount_rw();
foreach (array( SQUID_CONFBASE,
SQUID_ACLDIR,
@@ -1342,24 +1351,27 @@ function squid_resync() {
chgrp($dir, 'proxy');
squid_chown_recursive($dir, 'proxy', 'proxy');
}
- $conf = squid_resync_general() . "\n";
- $conf .= squid_resync_cache() . "\n";
- $conf .= squid_resync_redirector() . "\n";
- $conf .= squid_resync_upstream() . "\n";
- $conf .= squid_resync_nac() . "\n";
- $conf .= squid_resync_traffic() . "\n";
- $conf .= squid_resync_reverse() . "\n";
- $conf .= squid_resync_auth();
- squid_resync_users();
- squid_write_rcfile();
- squid_sync_on_changes();
-
+ if (!isset($boot_process)){
+ $conf = squid_resync_general() . "\n";
+ $conf .= squid_resync_cache() . "\n";
+ $conf .= squid_resync_redirector() . "\n";
+ $conf .= squid_resync_upstream() . "\n";
+ $conf .= squid_resync_nac() . "\n";
+ $conf .= squid_resync_traffic() . "\n";
+ $conf .= squid_resync_reverse() . "\n";
+ $conf .= squid_resync_auth();
+ squid_resync_users();
+ squid_write_rcfile();
+ squid_sync_on_changes();
+
+ #write config file
+ file_put_contents(SQUID_CONFBASE . '/squid.conf', $conf);
+ }
+
/* make sure pinger is executable */
if(file_exists("/usr/local/libexec/squid/pinger"))
exec("chmod a+x /usr/local/libexec/squid/pinger");
- file_put_contents(SQUID_CONFBASE . '/squid.conf', $conf);
-
$log_dir = $config['installedpackages']['squid']['config'][0]['log_dir'].'/';
if(!is_dir($log_dir)) {
@@ -1370,12 +1382,16 @@ function squid_resync() {
squid_dash_z();
+
if (!is_service_running('squid')) {
log_error("Starting Squid");
mwexec("/usr/local/sbin/squid");
- } else {
- log_error("Reloading Squid for configuration sync");
- mwexec("/usr/local/sbin/squid -k reconfigure");
+ }
+ else {
+ if (!isset($boot_process)){
+ log_error("Reloading Squid for configuration sync");
+ mwexec("/usr/local/sbin/squid -k reconfigure");
+ }
}
// Sleep for a couple seconds to give squid a chance to fire up fully.