exit; } if ($argv[1] == "--add-node") { add_node(); exit; } if ($argv[1] == "--tests-notifs") { send_notifications("Test From Artica Meta", "This is a test"); exit; } if ($argv[1] == "--ping-host") { ping_host($argv[2]); exit; } if ($argv[1] == "--ping-group") { ping_group($argv[2]); exit; } if (strlen($argv[1]) > 2) { meta_events("Unable to understand command {$argv[1]}"); } execute(); 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"; }
function ping_group_acls() { $sock = new sockets(); $ArticaMetaUseSendClient = intval($sock->GET_INFO("ArticaMetaUseSendClient")); if ($ArticaMetaUseSendClient == 0) { echo "Notify clients -> disbaled\n"; return; } $q = new mysql_squid_builder(); $sql = "SELECT metagroup FROM meta_webfilters_acls GROUP BY metagroup"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $metagroup = intval($ligne["metagroup"]); if ($metagroup == 0) { continue; } echo "Notify clients -> Group number {$metagroup}\n"; ping_group($metagroup); } $sql = "SELECT metauuid FROM meta_webfilters_acls GROUP BY metauuid"; $results = $q->QUERY_SQL($sql, "metaclient"); while ($ligne = mysql_fetch_assoc($results)) { $metauuid = $ligne["metauuid"]; echo "Notify clients -> UUID number {$metauuid}\n"; ping_host($metauuid); } }