new: [correlations] added new background task for correlating individual values

pull/7374/head
iglocska 2021-04-25 17:40:41 +02:00
parent 33c6ab7030
commit 5622546d5d
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 22 additions and 2 deletions

View File

@ -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();