mirror of https://github.com/MISP/MISP
fix: do not require jobId for AdminShell jobGenerateCorrelation, create a new job if jobId is null. fixes #9206
parent
1fdedb15c9
commit
53e16ce752
|
@ -126,11 +126,17 @@ class AdminShell extends AppShell
|
|||
|
||||
public function jobGenerateCorrelation()
|
||||
{
|
||||
if (empty($this->args[0])) {
|
||||
die('Usage: ' . $this->Server->command_line_functions['console_admin_tasks']['data']['Generate correlation'] . PHP_EOL);
|
||||
$jobId = $this->args[0] ?? null;
|
||||
if (empty($jobId)) {
|
||||
$jobId = $this->Job->createJob(
|
||||
'SYSTEM',
|
||||
Job::WORKER_DEFAULT,
|
||||
'generate correlation',
|
||||
'All attributes',
|
||||
'Job created.'
|
||||
);
|
||||
}
|
||||
|
||||
$jobId = $this->args[0];
|
||||
$this->Correlation->generateCorrelation($jobId);
|
||||
}
|
||||
|
||||
|
|
|
@ -140,9 +140,15 @@ class Correlation extends AppModel
|
|||
$attributeCount = 0;
|
||||
if (Configure::read('MISP.background_jobs') && $jobId) {
|
||||
$this->Job = ClassRegistry::init('Job');
|
||||
$this->Job->id = $jobId;
|
||||
} else {
|
||||
$jobId = false;
|
||||
}
|
||||
|
||||
if(!$this->Job->exists()){
|
||||
$jobId = false;
|
||||
}
|
||||
|
||||
if (!empty($eventIds)) {
|
||||
$eventCount = count($eventIds);
|
||||
foreach ($eventIds as $j => $currentEventId) {
|
||||
|
|
Loading…
Reference in New Issue