function others_update() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid)) { build_progress_influx("Already executed", 110); WriteMyLogs("Already executed PID:{$pid}, die()", __FUNCTION__, __FILE__, __LINE__); return; } if (!$GLOBALS["FORCE"]) { $TimeCache = $unix->file_time_min($cachetime); if ($TimeCache < 30) { build_progress_influx("Need at least 30Mn ( current {$TimeCache}mn ) ", 110); return; } } $TimeFile = $unix->file_time_min("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); $tmpfile = $unix->TEMP_DIR() . "/squid.update.db"; if ($GLOBALS["VERBOSE"]) { $TimeFile = 10000; } if (!$GLOBALS["FORCE"]) { if ($TimeFile < 480) { whatsnew(); return; } } $sock = new sockets(); build_progress_influx("{check_repository} (BigData Engine)", 20); $curl = new ccurl("http://articatech.net/influx.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} {failed}", 20); echo $curl->error . "\n"; @unlink($tmpfile); squid_admin_mysql(1, "Unable to retreive BigData Engine available versions", $curl->error, __FILE__, __LINE__); } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { build_progress_influx("{check_repository} (BigData Engine) {success}", 25); @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); @chmod("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo", 0755); build_progress_influx("{check_repository} {success}", 100); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} {failed}", 20); } @unlink($tmpfile); build_progress_influx("{check_repository} (Suricata)", 30); $curl = new ccurl("http://articatech.net/suricata.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} (Suricata) {failed}", 110); echo $curl->error . "\n"; @unlink($tmpfile); system_admin_mysql(1, "Unable to retreive Suricata available versions", $curl->error, __FILE__, __LINE__); squid_admin_mysql(1, "Unable to retreive Suricata available versions", $curl->error, __FILE__, __LINE__); } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { build_progress_influx("{check_repository} (Suricata) {success}", 35); @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetSuricataRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetSuricataRepo"); @chmod("/etc/artica-postfix/settings/Daemons/ArticaTechNetSuricataRepo", 0755); build_progress_influx("{check_repository} (Suricata) {success}", 40); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} (Suricata) {failed}", 35); } //------------------------------------------------------------------------------------------------------- @unlink($tmpfile); build_progress_influx("{check_repository} (HaProxy)", 40); $curl = new ccurl("http://articatech.net/haproxy.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} (HaProxy) {failed}", 40); echo $curl->error . "\n"; @unlink($tmpfile); system_admin_mysql(1, "Unable to retreive HaProxy available versions", $curl->error, __FILE__, __LINE__); squid_admin_mysql(1, "Unable to retreive HaProxy available versions", $curl->error, __FILE__, __LINE__); } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { build_progress_influx("{check_repository} (HaProxy) {success}", 45); @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetHaProxyRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetHaProxyRepo"); @chmod("/etc/artica-postfix/settings/Daemons/ArticaTechNetHaProxyRepo", 0755); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} (HaProxy) {failed}", 45); } //------------------------------------------------------------------------------------------------------- @unlink($tmpfile); build_progress_influx("{check_repository} (ProFTPD)", 50); $curl = new ccurl("http://articatech.net/proftpd.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} (ProFTPD) {failed}", 55); echo $curl->error . "\n"; @unlink($tmpfile); system_admin_mysql(1, "Unable to retreive ProFTPD available versions", $curl->error, __FILE__, __LINE__); squid_admin_mysql(1, "Unable to retreive ProFTPD available versions", $curl->error, __FILE__, __LINE__); } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { build_progress_influx("{check_repository} (ProFTPD) {success}", 55); @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetProFTPDRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetProFTPDRepo"); @chmod("/etc/artica-postfix/settings/Daemons/ArticaTechNetProFTPDRepo", 0755); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} (ProFTPD) {failed}", 55); } //------------------------------------------------------------------------------------------------------- build_progress_influx("{check_repository} (MailSecurity)", 50); $curl = new ccurl("http://articatech.net/mailsecurity.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} (MailSecurity) {failed}", 55); echo $curl->error . "\n"; @unlink($tmpfile); system_admin_mysql(1, "Unable to retreive MailSecurity available versions", $curl->error, __FILE__, __LINE__); squid_admin_mysql(1, "Unable to retreive MailSecurity available versions", $curl->error, __FILE__, __LINE__); } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { build_progress_influx("{check_repository} (MailSecurity) {success}", 55); @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetMailSecurityRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetMailSecurityRepo"); @chmod("/etc/artica-postfix/settings/Daemons/ArticaTechNetMailSecurityRepo", 0755); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} (MailSecurity) {failed}", 55); } //------------------------------------------------------------------------------------------------------- build_progress_influx("{check_repository} Whatsnew", 80); whatsnew(); build_progress_influx("{check_repository} {done}", 100); }
function others_update() { $unix = new unix(); $sock = new sockets(); $TimeFile = $unix->file_time_min("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); $tmpfile = $unix->TEMP_DIR() . "/squid.update.db"; if ($GLOBALS["VERBOSE"]) { $TimeFile = 10000; } if (!$GLOBALS["FORCE"]) { if ($TimeFile < 480) { whatsnew(); return; } } build_progress_influx("{check_repository}", 20); $curl = new ccurl("http://articatech.net/influx.php"); if (!$curl->GetFile($tmpfile)) { build_progress_influx("{check_repository} {failed}", 110); echo $curl->error . "\n"; @unlink($tmpfile); squid_admin_mysql(1, "Unable to retreive BigData Engine available versions", $curl->error, __FILE__, __LINE__); return; } $DATA = @file_get_contents($tmpfile); $ARRAY = unserialize(base64_decode($DATA)); if ($GLOBALS["VERBOSE"]) { print_r($ARRAY); } if (count($ARRAY) > 0) { @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); @copy("{$tmpfile}", "/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo"); build_progress_influx("{check_repository} {success}", 100); } else { echo "**** NOT AN ARRAY ****\n"; build_progress_influx("{check_repository} {failed}", 110); } @unlink($tmpfile); whatsnew(); }