<?php error_reporting(E_ALL | E_STRICT); require '../lib/cli.php'; require '../lib/factory.php'; F::init(); F::$dbo->setProfiling(false); $fields = array('conn' => array('processed' => 0, 'fields' => cli::CAT_FIELDS_CONN), 'rule' => array('processed' => 0, 'fields' => cli::CAT_FIELDS_RULE)); $_l = new nCurse(0, 40, 0, 0); $_l->reset('Process status'); $_l->refresh(); $_r = new nCurse(0, 0, 0, 40); $_r->reset('Process log'); $_r->refresh(); $totals = F::$dbo->fetch('SELECT cat_name, count(id) AS cnt FROM raw_log WHERE cat_name IN ("' . strtoupper(implode('","', array_keys($fields))) . '") GROUP BY cat_name'); foreach ($totals as $tRow) { $_l->sprintf(' %s: 0 of %s', $tRow['cat_name'], number_format($tRow['cnt'], 0)); } $_l->refresh(); foreach ($fields as $cat => $info) { $_r->println('Truncate table `cat_' . $cat . '`'); $_r->refresh(); F::$dbo->query('TRUNCATE `cat_' . $cat . '`'); $_r->println(' Collecting RAW data'); $_r->refresh(); $q = F::$dbo->query('SELECT id, remote_ip, datetime, data FROM raw_log WHERE cat_name = "' . strtoupper($cat) . '" ORDER BY id ASC'); $_r->println(' Processing'); $_r->refresh(); foreach ($q as $row) { $msgRaw = array(); foreach (explode("\n", $row['data']) as $value) {
<?php include '../lib/cli.php'; require '../lib/factory.php'; error_reporting(E_ALL | E_STRICT); try { declare (ticks=1); pcntl_signal(SIGINT, function () { exit; }); $_wLeft = new nCurse(0, 25, 0, 0); $_wRight = new nCurse(0, 0, 0, 25); $from = ''; $port = 0; F::init(); F::$dbo->setProfiling(false); $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_bind($socket, '10.10.1.210', 9091); $cats = array(); $gates = array(); $gc = array(); $gcTimings = array(); $fp = fopen("php://stdin", "r"); stream_set_blocking($fp, 0); $buffer = ''; while (true) { while (($buf = fgets($fp, 4096)) != false) { $buffer .= $buf; } if ($buffer != "") { switch ($buffer) {