function wrapzap_compile() { $sql = "SELECT * FROM squid_adzapper WHERE enabled=1"; $q = new mysql(); $f = array(); $tpl = new templates(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__); return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $f[] = "{$ligne["uri_type"]} {$ligne["uri"]}"; } echo "Starting......: adZapper " . count($f) . " rows\n"; @file_put_contents("/etc/squid3/zapper.post-database.txt", @implode("\n", $f)); $squiduser = SquidUser(); shell_exec("/bin/chown {$squiduser} /etc/squid3/zapper.pre-database.txt"); shell_exec("/bin/chown {$squiduser} /etc/squid3/zapper.post-database.txt"); if ($GLOBALS["RELOAD"]) { $unix = new unix(); shell_exec("{$GLOBALS["SQUIDBIN"]} -k reconfigure"); } }
function wrapzap_compile() { $sql = "SELECT * FROM squid_adzapper WHERE enabled=1"; $q = new mysql(); $f = array(); $tpl = new templates(); $unix = new unix(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__); return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $f[] = "{$ligne["uri_type"]} {$ligne["uri"]}"; } echo "Starting......: " . date("H:i:s") . " adZapper " . count($f) . " rows\n"; @file_put_contents("/etc/squid3/zapper.post-database.txt", @implode("\n", $f)); $squiduser = SquidUser(); $unix->chown_func($squiduser, null, "/etc/squid3/zapper.pre-database.txt"); $unix->chown_func($squiduser, null, "/etc/squid3/zapper.post-database.txt"); if ($GLOBALS["RELOAD"]) { $unix = new unix(); squid_watchdog_events("Reconfiguring Proxy parameters..."); if (function_exists("debug_backtrace")) { $trace = debug_backtrace(); if (isset($trace[1])) { $file = basename($trace[1]["file"]); $function = $trace[1]["function"]; $line = $trace[1]["line"]; $called = "Called by {$function}() from line {$line}"; } } $cmd = "/etc/init.d/squid reload --script=" . basename(__FILE__) . " >/dev/null"; shell_exec($cmd); } }