mirror of https://github.com/MISP/MISP
Merge 159512a174
into 14106b811a
commit
8005eedbfc
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3763,7 +3763,7 @@ class EventsController extends AppController
|
|||
$result = $this->ShadowAttribute->find('column', [
|
||||
'fields' => ['event_id'],
|
||||
'conditions' => $conditions,
|
||||
'unique' => true,
|
||||
// 'unique' => true,
|
||||
]);
|
||||
$this->Event->recursive = -1;
|
||||
|
||||
|
|
|
@ -1987,8 +1987,12 @@ class ServersController extends AppController
|
|||
$updateProgress['update_fail_number_reached'] = $this->Server->UpdateFailNumberReached();
|
||||
$currentIndex = $updateProgress['current'];
|
||||
$currentCommand = !isset($updateProgress['commands'][$currentIndex]) ? '' : $updateProgress['commands'][$currentIndex];
|
||||
$lookupString = preg_replace('/\s{2,}/', '', substr($currentCommand, 0, -1));
|
||||
$sqlInfo = $this->Server->query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;");
|
||||
$lookupString = preg_replace('/\s{2,}/', '', substr($currentCommand, 0, -1));
|
||||
if (empty($this->Server->query("SELECT * FROM version() WHERE version LIKE 'PostgreS%';"))) {
|
||||
$sqlInfo = $this->Server->query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;");
|
||||
} else {
|
||||
$this->Server->query("SELECT * FROM pg_stat_activity WHERE datname = 'misp';");
|
||||
}
|
||||
if (empty($sqlInfo)) {
|
||||
$updateProgress['process_list'] = array();
|
||||
} else {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1082,9 +1082,16 @@ class Correlation extends AppModel
|
|||
$this->CorrelationExclusion = ClassRegistry::init('CorrelationExclusion');
|
||||
$results['excluded_correlations'] = $this->CorrelationExclusion->find('count');
|
||||
foreach ($results['db'] as &$result) {
|
||||
foreach ($result['tables'] as $table_name => &$table_data) {
|
||||
$size_metrics = $this->query(sprintf('show table status like \'%s\';', $table_name));
|
||||
if (!empty($size_metrics)) {
|
||||
foreach ($result['tables'] as $table_name => &$table_data) {
|
||||
$row_count = 0;
|
||||
if ($this->isMysql()){
|
||||
$size_metrics = $this->query(sprintf('show table status like \'%s\';', $table_name));
|
||||
$row_count = (empty($size_metrics)) ? 0 : $size_metrics[0]['TABLES']['Rows'];
|
||||
} else {
|
||||
$size_metrics = $this->query(sprintf("select reltuples as estimate from pg_class where relname='%s';", $table_name));
|
||||
$row_count = (empty($size_metrics)) ? 0 : $size_metrics[0]['estimate'];
|
||||
}
|
||||
if ($row_count > 0) {
|
||||
$table_data['size_on_disk'] = $this->query(
|
||||
//'select FILE_SIZE from information_schema.innodb_sys_tablespaces where FILENAME like \'%/' . $table_name . '.ibd\';'
|
||||
sprintf(
|
||||
|
@ -1094,7 +1101,7 @@ class Correlation extends AppModel
|
|||
)
|
||||
)[0][0]['size'];
|
||||
$last_id = $this->query(sprintf('select max(id) as max_id from %s;', $table_name));
|
||||
$table_data['row_count'] = $size_metrics[0]['TABLES']['Rows'];
|
||||
$table_data['row_count'] = $row_count;
|
||||
$table_data['last_id'] = $last_id[0][0]['max_id'];
|
||||
$table_data['id_saturation'] = round(100 * $table_data['last_id'] / $table_data['id_limit'], 2);
|
||||
}
|
||||
|
|
|
@ -206,19 +206,19 @@ class EventTag extends AppModel
|
|||
}
|
||||
|
||||
public function getSortedTagList($context = false)
|
||||
{
|
||||
{
|
||||
$tag_counts = $this->find('all', array(
|
||||
'recursive' => -1,
|
||||
'fields' => array('tag_id', 'count(*)'),
|
||||
'group' => array('tag_id'),
|
||||
'fields' => array('tag_id', 'count(*) AS count'),
|
||||
'group' => array('Tag.id', 'Tag.name', 'EventTag.tag_id'),
|
||||
'contain' => array('Tag.name')
|
||||
));
|
||||
$temp = array();
|
||||
$tags = array();
|
||||
foreach ($tag_counts as $tag_count) {
|
||||
foreach ($tag_counts as $tag_count) {
|
||||
$temp[$tag_count['Tag']['name']] = array(
|
||||
'tag_id' => $tag_count['Tag']['id'],
|
||||
'eventCount' => $tag_count[0]['count(*)'],
|
||||
'eventCount' => $tag_count[0]['count'],
|
||||
'name' => $tag_count['Tag']['name'],
|
||||
);
|
||||
$tags[$tag_count['Tag']['name']] = $tag_count[0]['count(*)'];
|
||||
|
|
|
@ -26,7 +26,7 @@ class News extends AppModel
|
|||
public function latestNewsTimestamp()
|
||||
{
|
||||
$data = $this->find('first', [
|
||||
'order' => 'date_created DESC',
|
||||
'order' => 'News.date_created DESC',
|
||||
'fields' => ['date_created'],
|
||||
]);
|
||||
if (!$data) {
|
||||
|
|
|
@ -1714,7 +1714,7 @@ class User extends AppModel
|
|||
'ShadowAttribute.event_org_id' => $user['org_id'],
|
||||
'ShadowAttribute.deleted' => 0,
|
||||
),
|
||||
'fields' => 'distinct event_id'
|
||||
'fields' => 'DISTINCT event_id'
|
||||
]);
|
||||
return $results;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue