/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { //Init rena $app = RenaApp::getInstance(); $run = true; $oldKillID = 0; do { $p = \RedisQ\Action::listen("redisq.zkillboard.com"); if ($p["killID"] > $oldKillID) { // Get the killmail data. $k = $app->killmails->generateFromCREST($p); // Poke statsd $app->StatsD->increment("zKillboardReceived"); // Now lets make the json and hash $json = json_encode($k, JSON_NUMERIC_CHECK); $hash = hash("sha256", ":" . $k["killTime"] . ":" . $k["solarSystemID"] . ":" . $k["moonID"] . "::" . $k["victim"]["characterID"] . ":" . $k["victim"]["shipTypeID"] . ":" . $k["victim"]["damageTaken"] . ":"); // Push it over zmq to the websocket $context = new ZMQContext(); $socket = $context->getSocket(ZMQ::SOCKET_PUSH, "rena"); $socket->connect("tcp://localhost:5555"); $socket->send($json); // Lets insert the killmail! $app->killmails->insertKillmail($p["killID"], 0, $hash, "zkillboardRedisQ", $json); } $oldKillID = $p["killID"]; } while ($run == true); }
/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { //Init rena /** @var RenaApp $app */ $app = RenaApp::getInstance(); $run = true; $oldKillID = 0; do { $p = \RedisQ\Action::listen("redisq.zkillboard.com"); if ($p["killID"] > $oldKillID) { // Get the killmail data. $k = $app->CrestFunctions->generateFromCREST($p); // Poke statsd $app->StatsD->increment("zKillboardReceived"); // Now lets make the json and hash $json = json_encode($k, JSON_NUMERIC_CHECK); $hash = $app->CrestFunctions->generateCRESTHash($k); //$hash = hash("sha256", ":" . $k["killTime"] . ":" . $k["solarSystemID"] . ":" . $k["moonID"] . "::" . $k["victim"]["characterID"] . ":" . $k["victim"]["shipTypeID"] . ":" . $k["victim"]["damageTaken"] . ":"); // Lets insert the killmail! $insert = $app->killmails->insertIntoKillmails($p["killID"], 0, $hash, "zkillboardRedisQ", $json); // Upgrade it if ($insert > 0) { \Resque::enqueue("turbo", "\\ProjectRena\\Task\\Resque\\upgradeKillmail", array("killID" => $p["killID"])); } } $oldKillID = $p["killID"]; } while ($run == true); }