Merge pull request #8409 from JakubOnderka/fix-chaning-correlations

fix: [internal] Enabling/disabling correlations
pull/8412/head
Jakub Onderka 2022-05-26 16:34:31 +02:00 committed by GitHub
commit c22d3baded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -109,19 +109,13 @@ class AdminShell extends AppShell
public function jobPurgeCorrelation()
{
$this->ConfigLoad->execute();
if (empty($this->args[0])) {
die('Usage: ' . $this->Server->command_line_functions['console_admin_tasks']['data']['Purge correlation'] . PHP_EOL);
}
$jobId = $this->args[0];
$this->loadModel('Job');
$this->Job->id = $jobId;
$this->loadModel('Attribute');
$this->Attribute->purgeCorrelations();
$this->Job->saveField('progress', 100);
$this->Job->saveField('message', 'Job done.');
$this->Job->saveField('status', 4);
$this->Job->saveStatus($jobId);
}
public function jobGenerateShadowAttributeCorrelation()

View File

@ -2002,12 +2002,12 @@ class Server extends AppModel
if (!Configure::read('MISP.background_jobs')) {
$this->Attribute = ClassRegistry::init('Attribute');
if ($value) {
$k = $this->Attribute->purgeCorrelations();
$this->Attribute->purgeCorrelations();
} else {
$k = $this->Attribute->generateCorrelation();
$this->Attribute->generateCorrelation();
}
} else {
if ($value == true) {
if ($value) {
$jobType = 'jobPurgeCorrelation';
$jobTypeText = 'purge correlations';
} else {
@ -2029,7 +2029,6 @@ class Server extends AppModel
BackgroundJobsTool::DEFAULT_QUEUE,
BackgroundJobsTool::CMD_ADMIN,
[
'updateAfterPull',
$jobType,
$jobId
],