From 5622546d5d1aa15b177881b6e518771054b9148b Mon Sep 17 00:00:00 2001 From: iglocska Date: Sun, 25 Apr 2021 17:40:41 +0200 Subject: [PATCH] new: [correlations] added new background task for correlating individual values --- app/Console/Command/EventShell.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/Console/Command/EventShell.php b/app/Console/Command/EventShell.php index 69d7c5bc0..a93b743d0 100644 --- a/app/Console/Command/EventShell.php +++ b/app/Console/Command/EventShell.php @@ -10,7 +10,7 @@ require_once 'AppShell.php'; */ class EventShell extends AppShell { - public $uses = array('Event', 'Post', 'Attribute', 'Job', 'User', 'Task', 'Allowedlist', 'Server', 'Organisation'); + public $uses = array('Event', 'Post', 'Attribute', 'Job', 'User', 'Task', 'Allowedlist', 'Server', 'Organisation', 'Correlation'); public $tasks = array('ConfigLoad'); public function getOptionParser() @@ -92,7 +92,7 @@ class EventShell extends AppShell 'job_input' => $id, 'status' => 0, 'retries' => 0, - //'org' => $jobOrg, + 'org' => 0, 'message' => 'Job created.', ); $this->Job->save($data); @@ -107,6 +107,26 @@ class EventShell extends AppShell $this->Job->saveField('message', 'Job done.'); } + public function correlateValue() + { + $this->ConfigLoad->execute(); + $value = $this->args[0]; + $this->Job->create(); + $data = array( + 'worker' => 'default', + 'job_type' => 'correlateValue', + 'job_input' => $value, + 'status' => 0, + 'retries' => 0, + 'org' => 0, + 'message' => 'Job created.', + ); + $this->Job->save($data); + $this->Correlation->correlateValue($value, $this->Job->id); + $this->Job->saveField('status', 1); + $this->Job->saveField('message', 'Job done.'); + } + public function cache() { $this->ConfigLoad->execute();