mirror of https://github.com/MISP/MISP
2 Background worker issues fixed
- Start-up script could only be started from the script's location - Division by zero in e-mail alerts when calculating the progress of the background jobpull/274/merge
parent
6ccb5948f3
commit
72d4db3007
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
cd "${0%/*}"
|
||||||
../cake CakeResque.CakeResque stop --all
|
../cake CakeResque.CakeResque stop --all
|
||||||
../cake CakeResque.CakeResque start --interval 5 --queue default
|
../cake CakeResque.CakeResque start --interval 5 --queue default
|
||||||
../cake CakeResque.CakeResque start --interval 5 --queue cache
|
../cake CakeResque.CakeResque start --interval 5 --queue cache
|
||||||
|
|
|
@ -1150,45 +1150,46 @@ class Event extends AppModel {
|
||||||
// But only do this if it is allowed in the bootstrap.php file.
|
// But only do this if it is allowed in the bootstrap.php file.
|
||||||
//
|
//
|
||||||
if ($eventIsPrivate) {
|
if ($eventIsPrivate) {
|
||||||
$conditions = array('User.autoalert' => 1, 'User.gpgkey =' => "", 'User.org =' => $event['Event']['org']);
|
$conditions = array('User.autoalert' => 1, 'User.gpgkey =' => "", 'User.org =' => $event['Event']['org']);
|
||||||
} else {
|
} else {
|
||||||
$conditions = array('User.autoalert' => 1, 'User.gpgkey =' => "");
|
$conditions = array('User.autoalert' => 1, 'User.gpgkey =' => "");
|
||||||
}
|
}
|
||||||
if ('false' == Configure::read('GnuPG.onlyencrypted')) {
|
if ('false' == Configure::read('GnuPG.onlyencrypted')) {
|
||||||
$alertUsers = $this->User->find('all', array(
|
$alertUsers = $this->User->find('all', array(
|
||||||
'conditions' => $conditions,
|
'conditions' => $conditions,
|
||||||
'recursive' => 0,
|
'recursive' => 0,
|
||||||
));
|
));
|
||||||
$max = count($alertUsers);
|
$max = count($alertUsers);
|
||||||
foreach ($alertUsers as $k => &$user) {
|
foreach ($alertUsers as $k => &$user) {
|
||||||
// prepare the the unencrypted email
|
// prepare the the unencrypted email
|
||||||
$Email = new CakeEmail();
|
$Email = new CakeEmail();
|
||||||
$Email->from(Configure::read('MISP.email'));
|
$Email->from(Configure::read('MISP.email'));
|
||||||
$Email->to($user['User']['email']);
|
$Email->to($user['User']['email']);
|
||||||
$Email->subject("[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Event " . $id . " - " . $subject . $event['ThreatLevel']['name'] . " - TLP Amber");
|
$Email->subject("[" . Configure::read('MISP.org') . " " . Configure::read('MISP.name') . "] Event " . $id . " - " . $subject . $event['ThreatLevel']['name'] . " - TLP Amber");
|
||||||
$Email->emailFormat('text'); // both text or html
|
$Email->emailFormat('text'); // both text or html
|
||||||
// send it
|
// send it
|
||||||
$Email->send($bodySigned);
|
$Email->send($bodySigned);
|
||||||
$Email->reset();
|
$Email->reset();
|
||||||
if ($processId) {
|
if ($processId) {
|
||||||
$this->Job->id = $processId;
|
$this->Job->id = $processId;
|
||||||
$this->Job->saveField('progress', $k / $max * 50);
|
$this->Job->saveField('progress', $k / $max * 50);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
}
|
||||||
// Build a list of the recipients that wish to receive encrypted mails.
|
//
|
||||||
//
|
// Build a list of the recipients that wish to receive encrypted mails.
|
||||||
if ($eventIsPrivate) {
|
//
|
||||||
$conditions = array('User.autoalert' => 1, 'User.gpgkey !=' => "", 'User.org =' => $event['Event']['org']);
|
if ($eventIsPrivate) {
|
||||||
} else {
|
$conditions = array('User.autoalert' => 1, 'User.gpgkey !=' => "", 'User.org =' => $event['Event']['org']);
|
||||||
$conditions = array('User.autoalert' => 1, 'User.gpgkey !=' => "");
|
} else {
|
||||||
}
|
$conditions = array('User.autoalert' => 1, 'User.gpgkey !=' => "");
|
||||||
$alertUsers = $this->User->find('all', array(
|
}
|
||||||
'conditions' => $conditions,
|
$alertUsers = $this->User->find('all', array(
|
||||||
'recursive' => 0,
|
'conditions' => $conditions,
|
||||||
)
|
'recursive' => 0,
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
$max = count($alertUsers);
|
||||||
// encrypt the mail for each user and send it separately
|
// encrypt the mail for each user and send it separately
|
||||||
foreach ($alertUsers as $k => &$user) {
|
foreach ($alertUsers as $k => &$user) {
|
||||||
// send the email
|
// send the email
|
||||||
|
|
Loading…
Reference in New Issue