本文整理汇总了PHP中unix::get_pid_from_file方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::get_pid_from_file方法的具体用法?PHP unix::get_pid_from_file怎么用?PHP unix::get_pid_from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::get_pid_from_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
function start()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
$PID = GET_PID();
if ($unix->process_exists($PID)) {
squid_admin_mysql(1, "Watchdog says that rsyslog is off, but exists [action=stamp-pid]", null, __FILE__, __LINE__);
$SrcPid = intval(@file_get_contents("/var/run/rsyslogd.pid"));
if ($SrcPid != $PID) {
squid_admin_mysql(2, "Watchdog says that rsyslog is off (PID:{$SrcPid}), but exists (PID:{$PID}) [action=stamp-pid]", null, __FILE__, __LINE__);
@file_put_contents("/var/run/rsyslogd.pid", $PID);
} else {
squid_admin_mysql(2, "Watchdog says that rsyslog is off (PID:{$SrcPid}), but exists [action=nothing]", null, __FILE__, __LINE__);
}
@unlink($pidfile);
die(1);
}
squid_admin_mysql(0, "Syslog daemon is down [action=start]", null, __FILE__, __LINE__);
system("/etc/init.d/rsyslog start");
$squid = $unix->LOCATE_SQUID_BIN();
if (is_file($squid)) {
sleep(3);
squid_admin_mysql(1, "Reloading proxy service after starting syslog daemon", null, __FILE__, __LINE__);
system("{$squid} -f /etc/squid3/squid.conf -k reconfigure");
}
}
示例2: build
function build()
{
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$unix = new unix();
$sock = new sockets();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
die;
}
$php = $unix->LOCATE_PHP5_BIN();
@file_put_contents($pidfile, getmypid());
progress("{get_system_informations}", 30);
support_step1();
progress("{APP_UFDBGUARD}", 40);
$EnableUfdbGuard = intval($sock->EnableUfdbGuard());
if ($EnableUfdbGuard == 1) {
$ufdbguardd = $unix->find_program("ufdbguardd");
if (is_file($ufdbguardd)) {
shell_exec("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force --verbose >/usr/share/artica-postfix/ressources/support/build-ufdbguard.log 2>&1");
}
}
progress("{get_all_logs}", 50);
support_step2();
progress("{get_all_logs}", 70);
export_tables();
progress("{compressing_package}", 90);
support_step3();
progress("{success}", 100);
}
示例3: xstart
function xstart()
{
$unix = new unix();
$sock = new sockets();
$GLOBALS["CLASS_SOCKETS"] = $sock;
$FORCED_TEXT = null;
$NOTIFY = false;
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidTime = "/usr/share/artica-postfix/ressources/logs/ARTICA_DBS_STATUS_FULL.db";
$pid = $unix->get_pid_from_file($pidfile);
$GLOBALS["CLASS_UNIX"] = $unix;
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
echo "Already executed\n";
return;
}
if (!$GLOBALS["FORCE"]) {
if ($unix->file_time_min($pidTime) < 30) {
return;
}
}
$GLOBALS["MAIN_ARRAY"] = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/ARTICA_DBS_STATUS.db"));
ArticaWebFilter();
ArticaUfdb();
@mkdir("/usr/share/artica-postfix/ressources/logs", 0755, true);
@unlink($pidTime);
@file_put_contents($pidTime, serialize($GLOBALS["MAIN_ARRAY"]));
if ($GLOBALS["VERBOSE"]) {
echo "Saving {$pidTime}\n";
}
@chmod($pidTime, 0755);
}
示例4: scan_connections
function scan_connections()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Artica Task Already running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
if (system_is_overloaded()) {
system_admin_events("Overloaded system, aborting task", __FUNCTION__, __FILE__, __LINE__);
return false;
}
$q = new mysql();
$sql = "SELECT * FROM texttoldap";
$results = $q->QUERY_SQL($sql, "artica_backup");
if (mysql_num_rows($results) == 0) {
return;
}
while ($ligne = mysql_fetch_assoc($results)) {
if (!connect($ligne)) {
continue;
}
import($ligne);
$ID = $ligne["ID"];
}
}
示例5: xstart
function xstart()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
$TimeExec = $unix->file_time_min($pidtime);
if ($TimeExec < 360) {
return;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
@file_put_contents($pidfile, getmypid());
$php5 = $unix->LOCATE_PHP5_BIN();
$q = new mysql_squid_builder();
$q->CreateCategoryUrisTable("malware");
$COUNT1 = $q->COUNT_ROWS("categoryuris_malware");
vxvault();
malwareurls_joxeankoret();
clean_mx_de();
$COUNT2 = $q->COUNT_ROWS("categoryuris_malware");
$URLS_ADDED = $COUNT2 - $COUNT1;
if ($URLS_ADDED > 0) {
system("{$php5} /usr/share/artica-postfix/exec.squidguard.php --compile-category malware");
squid_admin_mysql(2, "{$URLS_ADDED} malware URLs added", null, __FILE__, __LINE__);
}
}
示例6: parse
function parse()
{
$TimeFile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.time";
$pidfile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.pid";
$GLOBALS["LogFileDeamonLogDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/LogFileDeamonLogDir");
if ($GLOBALS["LogFileDeamonLogDir"] == null) {
$GLOBALS["LogFileDeamonLogDir"] = "/home/artica/squid/realtime-events";
}
$unix = new unix();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pid} already executed since {$timepid}Mn\n";
}
if ($timepid < 14) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($pidfile, getmypid());
$TimeExec = $unix->file_time_min($TimeFile);
if (!$GLOBALS["FORCE"]) {
if ($TimeExec < 20) {
return;
}
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
parsedb("/var/log/squid");
parsedb($GLOBALS["LogFileDeamonLogDir"]);
}
示例7: CheckCMDLine
function CheckCMDLine()
{
$unix = new unix();
$PID_FILE = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pid = $unix->get_pid_from_file($PID_FILE);
if ($unix->process_exists($pid)) {
return;
}
@file_put_contents($PID_FILE, getmypid());
if (system_is_overloaded()) {
die;
}
$sock = new sockets();
$ips = unserialize(base64_decode($sock->GET_INFO("RBLCheckIPList")));
if (count($ips) > 0) {
if ($GLOBALS["VERBOSE"]) {
echo count($ips) . " elements to check\n";
}
if (is_array($ips)) {
while (list($num, $ip) = each($ips)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$ip} element...\n";
}
ChecksDNSBL($ip, false, true);
}
ChecksDNSBL();
return;
}
}
ChecksDNSBL();
}
示例8: purge
function purge()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidtime = "/etc/artica-postfix/pids/exec.suricata.hourly.purge.time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
echo "Starting......: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
return;
}
@file_put_contents($pidfile, getmypid());
if (system_is_overloaded()) {
return;
}
$timeExec = $unix->file_time_min($pidtime);
if ($timeExec < 1440) {
return;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
$q = new postgres_sql();
$sock = new sockets();
$SuricataPurge = intval($sock->GET_INFO("SuricataPurge"));
if ($SuricataPurge == 0) {
$SuricataPurge = 15;
}
$q->QUERY_SQL("DELETE FROM suricata_events WHERE zdate < NOW() - INTERVAL '{$SuricataPurge} days'");
}
示例9: importActivedirectoryusers
function importActivedirectoryusers()
{
$sock = new sockets();
$EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
if (!is_numeric($EnableKerbAuth)) {
$EnableKerbAuth = 0;
}
if ($EnableKerbAuth == 0) {
return;
}
$unix = new unix();
$user = new settings_inc();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
$pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
WriteMyLogs("Process {$pid} already exists", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (system_is_overloaded(basename(__FILE__))) {
WriteMyLogs("Overloaded system, aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
@file_put_contents($pidfile, getmypid());
$TImeStamp = $unix->file_time_min($pidTime);
if (!$GLOBALS["FORCE"]) {
if ($TImeStamp < 20) {
WriteMyLogs("Need 20mn, current={$TImeStamp}Mn executed by:{$GLOBALS["EXECUTOR"]} Params:{$GLOBALS["PARAMS"]}", __FUNCTION__, __FILE__, __LINE__);
return;
}
}
@unlink($pidTime);
@file_put_contents($pidTime, time());
$netbin = $unix->LOCATE_NET_BIN_PATH();
$usermod = $unix->find_program("usermod");
$chmod = $unix->find_program("chmod");
if (!is_file($netbin)) {
WriteMyLogs("net no such binary, aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (is_dir("/var/run/samba/winbindd_privileged")) {
shell_exec("{$usermod} -G winbindd_priv squid >/dev/null 2>&1");
shell_exec("{$chmod} 0750 /var/run/samba/winbindd_privileged/ >/dev/null 2>&1");
}
$array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
$domainUp = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
$domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
$adminpassword = $array["WINDOWS_SERVER_PASS"];
$adminpassword = $unix->shellEscapeChars($adminpassword);
$adminname = $array["WINDOWS_SERVER_ADMIN"];
$ad_server = $array["WINDOWS_SERVER_NETBIOSNAME"];
$GLOBALS["AUTHCMD"] = " -U {$adminname}%{$adminpassword}";
getNetInfos();
if (!isset($GLOBALS["LDAP_HOST"])) {
WriteMyLogs("Unable to get ldap infos, aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
GetUsersArray();
}
示例10: build_blacklists
function build_blacklists($aspid = false)
{
$unix = new unix();
$FINALARRAY = array();
$f = array();
$PidFile = "/etc/artica-postfix/pids/squid_build_blacklists.pid";
$dbfile = "/var/log/squid/ufdbgclient.black.db";
if ($aspid) {
$pid = $unix->get_pid_from_file($PidFile);
if ($pid != getmypid()) {
if ($unix->process_exists($pid, basename(__FILE__))) {
echo "Starting......: " . date("H:i:s") . " Blacklists: Another artica script running pid {$pid}, aborting ...\n";
WriteToSyslogMail("build_blacklists():: Another artica script running pid {$pid}, aborting ...", basename(__FILE__));
return;
}
}
}
@unlink($dbfile);
try {
echo "berekley_db:: Creating {$dbfile} database\n";
$db_desttmp = @dba_open($dbfile, "c", "db4");
@dba_close($db_desttmp);
} catch (Exception $e) {
$error = $e->getMessage();
echo "berekley_db::FATAL ERROR {$error} on {$dbfile}\n";
return;
}
$q = new mysql_squid_builder();
$array = array();
$db_con = @dba_open($dbfile, "c", "db4");
$sql = "SELECT * FROM deny_websites";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " [ACLS]: {$q->mysql_error}\n";
return;
}
@unlink("/etc/squid3/www-blacklists.db");
while ($ligne = mysql_fetch_assoc($results)) {
if ($ligne["items"] == null) {
continue;
}
$item = $ligne["items"];
$item = str_replace("/", "\\/", $item);
$item = str_replace(".", "\\.", $item);
$item = str_replace("*", ".*?", $item);
@dba_replace($item, $item, $db_con);
$array[] = $ligne["items"];
}
@dba_close($db_con);
@file_put_contents("/var/log/squid/ufdbgclient.reload", "#");
@chown("/var/log/squid/ufdbgclient.reload", "squid");
@chgrp("/var/log/squid/ufdbgclient.reload", "squid");
$acl = new squid_acls();
$url_rewrite_program = $acl->clean_dstdomains($array);
echo "Starting......: " . date("H:i:s") . " [ACLS]: " . count($url_rewrite_program) . " blacklisted webistes\n";
@file_put_contents("/etc/squid3/www-blacklists.db", @implode("\n", $url_rewrite_program) . "\n");
@chown("/etc/squid3/www-blacklists.db", "squid");
@chgrp("/etc/squid3/www-blacklists.db", "squid");
}
示例11: start
function start()
{
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$unix = new unix();
$pid = $unix->get_pid_from_file($pidFile);
if ($unix->process_exists($pid)) {
return;
}
@file_put_contents($pidFile, getmypid());
$time = $unix->file_time_min($pidtime);
if ($time < 5) {
return;
}
@file_put_contents($pidtime, time());
$free = $unix->find_program("free");
$echo = $unix->find_program("echo");
$sync = $unix->find_program("sync");
$swapoff = $unix->find_program("swapoff");
$swapon = $unix->find_program("swapon");
exec("{$free} 2>&1", $results);
$used = 0;
$total = 0;
while (list($num, $ligne) = each($results)) {
if (preg_match("#Swap:\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)#", $ligne, $re)) {
$total = $re[1];
$used = $re[2];
}
}
if (!is_numeric($total)) {
return;
}
if ($total == 0) {
return;
}
if ($used == 0) {
return;
}
if ($total == $used) {
return;
}
$tot1 = $used / $total;
$tot1 = $tot1 * 100;
if ($GLOBALS["VERBOSE"]) {
echo "Swap:{$used}/{$total} - {$tot1}\n";
}
$perc = round($tot1);
if ($GLOBALS["VERBOSE"]) {
echo "Swap:{$used}/{$total} {$perc}%\n";
}
$t = time();
$GLOBALS["ALL_SCORES"]++;
shell_exec("{$swapoff} -a && {$swapon} -a");
$usedTXT = FormatBytes($used);
$report = $unix->ps_mem_report();
$distance = $unix->distanceOfTimeInWords($t, time(), true);
squid_admin_mysql(0, "System swap exceed rule: {$perc}%", "Used {$usedTXT}\nSystem cache was flushed took {$distance}\nThis means you did have enough memory for this computer.\n{$report}", __FILE__, __LINE__);
}
示例12: compile_destination
function compile_destination($cacheid)
{
$unix = new unix();
$sock = new sockets();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".compile_destination." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
if (!is_numeric($cacheid)) {
build_progress("Error Destination ID is not set", 110);
return;
}
if ($cacheid == 0) {
build_progress("Error Destination ID is Zero", 110);
return;
}
$q = new mysql_squid_builder();
$sql = "SELECT servername FROM reverse_www WHERE cache_peer_id={$cacheid}";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
build_progress("Error MySQL error", 110);
echo $q->mysql_error;
return;
}
$count = mysql_num_rows($results);
if ($count == 0) {
echo "{$sql}\n";
build_progress("Error no destination for ID {$cacheid}", 110);
return;
}
build_progress("{$count} Destination(s)", 5);
$c = 0;
$php = $unix->LOCATE_PHP5_BIN();
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$c++;
$prc = $c / $count;
$prc = $prc * 100;
if ($prc > 90) {
$prc = 90;
}
$servername = $ligne["servername"];
build_progress("{reconfigure} {$servername}", $prc);
system("{$php} /usr/share/artica-postfix/exec.nginx.single.php {$servername} --no-reload --output --no-buildmain");
}
build_progress("{cleaning_old_configs}...", 91);
system("{$php} /usr/share/artica-postfix/exec.nginx.wizard.php --check-http");
build_progress("{building_main_settings}", 95);
system("{$php} /usr/share/artica-postfix/exec.nginx.php --main");
build_progress("{$ligne["servername"]}: {reloading_reverse_proxy} ", 96);
system("/etc/init.d/nginx reload --force");
build_progress("{$ligne["servername"]}: {reloading_reverse_proxy} {done}", 100);
}
示例13: install_key
function install_key($keyfile)
{
$path = "/usr/share/artica-postfix/ressources/conf/upload/{$keyfile}";
$license_bin = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager";
$time = time();
$unix = new unix();
$pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidFile);
if ($unix->process_exists($pid)) {
if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) {
progress("{failed} Already running", 110);
echo "Already runinng PID {$pid}\n";
return;
}
}
echo "License....: {$path}\n";
echo "Binary File: {$license_bin}\n";
if (!is_file($path)) {
echo "{$path} No such file..\n";
progress("{failed} {$keyfile} No such file", 110);
die;
}
if (!is_file($license_bin)) {
echo "{$path} No such file..\n";
progress("{failed} " . basename($license_bin) . " No such binary", 110);
@unlink($path);
die;
}
$sock = new sockets();
$nohup = $unix->find_program("nohup");
$sock->SET_INFO("kavicapserverEnabled", 1);
@unlink("/etc/artica-postfix/kav4proxy-licensemanager");
@unlink("/etc/artica-postfix/kav4proxy-licensemanager-i");
progress("{removing_old_licenses}", 20);
system("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -d a");
progress("{installing} {$keyfile}", 30);
$cmd = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -c /etc/opt/kaspersky/kav4proxy.conf -a {$path}";
system($cmd);
@unlink($path);
progress("{analyze_license} {$keyfile}", 50);
shell_exec("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -i >/etc/artica-postfix/kav4proxy-licensemanager-i 2>&1");
progress("{stopping_service}", 60);
echo "/etc/init.d/kav4proxy stop\n";
system("/etc/init.d/kav4proxy stop");
progress("{starting_service}", 60);
echo "/etc/init.d/kav4proxy start\n";
system("{$nohup} /etc/init.d/kav4proxy start >/dev/null 2>&1 &");
system("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
progress("{launch_updates}", 70);
$nohup = $unix->find_program("nohup");
$php = $unix - LOCATE_PHP5_BIN();
sleep(2);
progress("{launch_updates}", 80);
shell_exec("{$nohup} /usr/share/artica-postfix/exec.keepup2date.php --update --force >/dev/null 2>&1 &");
sleep(3);
progress("{success}", 100);
}
示例14: sealion_pid
function sealion_pid()
{
$unix = new unix();
$pid = $unix->get_pid_from_file("/usr/local/sealion-agent/var/run/sealion.pid");
if ($unix->process_exists($pid)) {
return $pid;
}
return 0;
}
示例15: squid_transparent_exe
function squid_transparent_exe()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
@file_put_contents($pidfile, getmypid());
$sock = new sockets();
$squid = new squidbee();
$WizardProxyTransparent = unserialize($sock->GET_INFO("WizardProxyTransparent"));
$WizardProxyTransparent = unserialize($sock->GET_INFO("WizardProxyTransparent"));
$connected_port = intval($WizardProxyTransparent["connected_port"]);
$transparent_port = intval($WizardProxyTransparent["transparent_port"]);
$transparent_ssl_port = intval($WizardProxyTransparent["transparent_ssl_port"]);
$EnableSSLBump = intval($WizardProxyTransparent["EnableSSLBump"]);
if ($connected_port == 0) {
build_progress("Fatal connected port unconfigured", 110);
return;
}
if ($transparent_port == 0) {
build_progress("Fatal Transparent port unconfigured", 110);
return;
}
echo "Connected port........: {$connected_port}\n";
echo "Transparent port......: {$transparent_port}\n";
echo "Transparent SSL.......: {$EnableSSLBump}/{$transparent_ssl_port}\n";
sleep(3);
build_progress("{reconfigure}", 20);
$squid = new squidbee();
$squid->listen_port = $transparent_port;
$squid->second_listen_port = $connected_port;
$squid->hasProxyTransparent = 1;
if ($EnableSSLBump == 1) {
echo "EnableSquidSSLCRTD ----> 1\n";
$sock->SET_INFO("EnableSquidSSLCRTD", 1);
$squid->SSL_BUMP = 1;
$squid->ssl_port = $transparent_ssl_port;
}
build_progress("{saving_parameters}", 20);
sleep(3);
$squid->SaveToLdap(true);
echo "hasProxyTransparent -------> 1\n";
$sock->SET_INFO("hasProxyTransparent", 1);
echo "SquidTransparentMixed -----> 1\n";
$sock->SET_INFO("SquidTransparentMixed", 1);
build_progress("{building_settings}", 30);
$php = $unix->LOCATE_PHP5_BIN();
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
build_progress("{restarting_service}", 50);
system("{$php} /usr/share/artica-postfix/exec.squid.watchdog.php --restart --force");
build_progress("{apply_firewall_rules}", 90);
system("{$php} /usr/share/artica-postfix/exec.squid.transparent.php --force");
build_progress("{done}", 100);
}