function execute() { $unix = new unix(); $sock = new sockets(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; if ($GLOBALS["VERBOSE"]) { echo "cachetime:{$cachetime}\n"; } $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid)) { die; } $TimeEx = $unix->file_time_min($cachetime); if (!$GLOBALS["FORCE"]) { if ($TimeEx < 20) { return; } } $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); if ($EnableArticaMetaServer == 0) { return; } @unlink($cachetime); @file_put_contents($cachetime, time()); @file_put_contents($pidfile, getmypid()); scan_repos(); scan_software_repo(); extract_all_tgz(); checkufdb(); clean_tables(); }
function execute() { $unix = new unix(); $sock = new sockets(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $php5 = $unix->LOCATE_PHP5_BIN(); $nohup = $unix->find_program("nohup"); if ($GLOBALS["VERBOSE"]) { echo "cachetime:{$cachetime}\n"; } $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid)) { die; } $TimeEx = $unix->file_time_min($cachetime); if (!$GLOBALS["FORCE"]) { if ($TimeEx < 20) { return; } } $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); if ($EnableArticaMetaServer == 0) { return; } $ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage"); if ($ArticaMetaStorage == null) { $ArticaMetaStorage = "/home/artica-meta"; } @unlink($cachetime); @file_put_contents($cachetime, time()); @file_put_contents($pidfile, getmypid()); meta_stats(); scan_repos(); scan_softs(); scan_software_repo(); scan_categories(); scan_temp_queue(); extract_all_tgz(); checkufdb(); clean_tables(); if (is_file("{$ArticaMetaStorage}/webfiltering/ufdbartica.txt")) { @unlink("/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer"); @copy("{$ArticaMetaStorage}/webfiltering/ufdbartica.txt", "/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer"); @chmod("/etc/artica-postfix/settings/Daemons/MetaUfdbArticaVer", 0755); } $cmd = trim("{$nohup} {$php5} /usr/share/artica-postfix/exec.artica-meta-squid-parser.php >/dev/null 2>&1 &"); meta_events($cmd); shell_exec($cmd); }