function build() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $oldpid = @file_get_contents($pidfile); if ($unix->process_exists($oldpid)) { echo "Starting......: c-icap " . __FUNCTION__ . "() already running PID:{$oldpid}\n"; return; } @file_put_contents($pidfile, getmypid()); $cicap = new cicap(); $cicap->buildconf(); $squid = new squidbee(); $conf = $squid->BuildSquidConf(); $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH(); echo "Starting......: c-icap reconfigure squid done...\n"; @file_put_contents($SQUID_CONFIG_PATH, $conf); @mkdir("/usr/etc", 0755, true); CicapMagic("/usr/etc/c-icap.magic"); dbMaintenanceSchedule(); }
function build($aspid = false) { $unix = new unix(); $ln = $unix->find_program("ln"); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); if (!$aspid) { if ($unix->process_exists($pid)) { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service " . __FUNCTION__ . "() already running PID:{$pid}\n"; return; } @file_put_contents($pidfile, getmypid()); } $chmod = $unix->find_program("chmod"); $cicap = new cicap(); $cicap->buildconf(); $ln = $unix->find_program("ln"); if (is_file("/opt/kaspersky/khse/libexec/libframework.so")) { if (!is_file("/lib/libframework.so")) { shell_exec("{$ln} -s /opt/kaspersky/khse/libexec/libframework.so /lib/libframework.so"); } } if (is_file("/opt/kaspersky/khse/libexec/libyaml-cpp.so.0.2")) { if (!is_file("/lib/libyaml-cpp.so.0.2")) { shell_exec("{$ln} -s /opt/kaspersky/khse/libexec/libyaml-cpp.so.0.2 /lib/libyaml-cpp.so.0.2"); } } if (!is_file("/lib/libbz2.so.1.0")) { if (is_file("/usr/lib/c_icap/libbz2.so.1.0.4")) { shell_exec("{$ln} -s /usr/lib/c_icap/libbz2.so.1.0.4 /lib/libbz2.so.1.0"); } } if (is_dir("/opt/kaspersky/khse/libexec")) { shell_exec("{$chmod} 755 /opt/kaspersky/khse/libexec >/dev/null 2>&1"); shell_exec("{$chmod} -R 755 /opt/kaspersky/khse/libexec/ >/dev/null 2>&1"); @unlink("/opt/kaspersky/khse/etc/notify/object_infected"); shell_exec("{$ln} -s /opt/kaspersky/kav4proxy/share/notify/object_infected /opt/kaspersky/khse/etc/notify/object_infected"); } $unix = new unix(); $squidbin = $unix->LOCATE_SQUID_BIN(); $unix->SystemCreateUser("clamav", "clamav"); if (!$unix->SystemUserExists("squid")) { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service creating user `squid`\n"; $unix->SystemCreateUser("squid", "squid"); } else { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service user `squid` exists...\n"; } if (is_file($squidbin)) { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service squid binary is `{$squidbin}`\n"; } if (is_file($squidbin)) { $squid = new squidbee(); $conf = $squid->BuildSquidConf(); memboost(); $SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH(); echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service reconfigure squid done...\n"; @file_put_contents($SQUID_CONFIG_PATH, $conf); } else { echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service skip reconfigure squid (not installed)...\n"; } @mkdir("/usr/etc", 0755, true); CicapMagic("/usr/etc/c-icap.magic"); echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service generate template...\n"; gen_template(); if (is_file($squidbin)) { dbMaintenanceSchedule(); } }