diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php
index c2da8a566..5c51f401c 100755
--- a/app/Controller/EventsController.php
+++ b/app/Controller/EventsController.php
@@ -1418,22 +1418,31 @@ class EventsController extends AppController {
}
}
if ($this->Event->delete()) {
-
- // delete the event from remote servers
- //if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) &&
- // $this->__deleteEventFromServers($uuid);
- //}
- $this->Session->setFlash(__('Event deleted'));
-
- // if coming from index, redirect to referer (to have the filter working)
- // else redirect to index
- if (strpos($this->referer(), '/view') !== FALSE)
+ if ($this->_isRest() || $this->response->type() === 'application/json') {
+ $this->set('message', 'Event deleted.');
+ $this->set('_serialize', array('message'));
+ } else {
+ // delete the event from remote servers
+ //if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) &&
+ // $this->__deleteEventFromServers($uuid);
+ //}
+ $this->Session->setFlash(__('Event deleted'));
+
+ // if coming from index, redirect to referer (to have the filter working)
+ // else redirect to index
+ if (strpos($this->referer(), '/view') !== FALSE)
+ $this->redirect(array('action' => 'index'));
+ else
+ $this->redirect($this->referer(array('action' => 'index')));
+ }
+ } else {
+ if ($this->_isRest() || $this->response->type() === 'application/json') {
+ throw new Exception('Event was not deleted');
+ } else {
+ $this->Session->setFlash(__('Event was not deleted'));
$this->redirect(array('action' => 'index'));
- else
- $this->redirect($this->referer(array('action' => 'index')));
+ }
}
- $this->Session->setFlash(__('Event was not deleted'));
- $this->redirect(array('action' => 'index'));
}
/**
diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php
index f20458c45..b74b4d5dd 100755
--- a/app/Controller/ServersController.php
+++ b/app/Controller/ServersController.php
@@ -319,7 +319,7 @@ class ServersController extends AppController {
$stixOperational = array(0 => 'STIX or CyBox library not installed correctly', 1 => 'OK');
$stixVersion = array(0 => 'Incorrect STIX version installed, found $current, expecting $expected', 1 => 'OK');
$cyboxVersion = array(0 => 'Incorrect CyBox version installed, found $current, expecting $expected', 1 => 'OK');
- $sessionErrors = array(0 => 'OK', 1 => 'High');
+ $sessionErrors = array(0 => 'OK', 1 => 'High', 2 => 'Alternative setting used');
$finalSettings = $this->Server->serverSettingsRead();
$issues = array(
diff --git a/app/Model/Server.php b/app/Model/Server.php
index b977e2818..18f03e194 100755
--- a/app/Model/Server.php
+++ b/app/Model/Server.php
@@ -1552,6 +1552,10 @@ class Server extends AppModel {
}
public function sessionDiagnostics(&$diagnostic_errors, &$sessionCount) {
+ if (Configure::read('Session.defaults') !== 'database') {
+ $sessionCount = 'N/A';
+ return 2;
+ }
$sql = 'SELECT COUNT(id) FROM `cake_sessions` WHERE `expires` < ' . time() . ';';
$sessionCount = $this->query($sql)[0][0]['COUNT(id)'];
$sessionStatus = 0;
diff --git a/app/View/Elements/healthElements/diagnostics.ctp b/app/View/Elements/healthElements/diagnostics.ctp
index dffbb0a96..b3a759cc0 100644
--- a/app/View/Elements/healthElements/diagnostics.ctp
+++ b/app/View/Elements/healthElements/diagnostics.ctp
@@ -133,11 +133,16 @@
0) {
- $colour = 'red';
- }
+ $sessionColours = array(0 => 'green', 1 => 'red', 2 => 'orange');
+ $colour = $sessionColours[$sessionStatus];
echo 'Expired sessions....' . $sessionCount . ' (' . $message . ')' . '';
?>
+
Purge sessions
+