From 966dc63a928be07dce196f953fd49cde6b2b603c Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 26 Apr 2023 17:16:34 +0200 Subject: [PATCH] #9771 changes in summary and new fields for trecon_task --- pandora_console/extras/mr/63.sql | 1 + .../godmode/wizards/DiscoveryTaskList.class.php | 13 ++++++++++--- pandora_console/pandoradb.sql | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pandora_console/extras/mr/63.sql b/pandora_console/extras/mr/63.sql index 32caab51df..0a04181b57 100644 --- a/pandora_console/extras/mr/63.sql +++ b/pandora_console/extras/mr/63.sql @@ -41,6 +41,7 @@ CREATE TABLE IF NOT EXISTS `tdiscovery_apps_tasks_macros` ( ALTER TABLE `trecon_task` ADD COLUMN `id_app` int(10), ADD COLUMN `setup_complete` tinyint unsigned NOT NULL DEFAULT 0, + ADD COLUMN `executions_timeout` int unsigned NOT NULL DEFAULT 60, ADD FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE IF NOT EXISTS `tsesion_filter` ( diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 22f5f80e1b..e3bd3da3a8 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -1395,14 +1395,14 @@ class DiscoveryTaskList extends HTML $output = ''; - if (is_array($task['stats']) === false) { + if (is_array($task['stats']) === false && (int) $task['type'] !== DISCOVERY_EXTENSION) { $task['stats'] = json_decode($task['summary'], true); if (json_last_error() !== JSON_ERROR_NONE) { return $task['summary']; } } - if (is_array($task['stats'])) { + if (is_array($task['stats']) || (int) $task['type'] === DISCOVERY_EXTENSION) { $i = 0; $table = new StdClasS(); $table->class = 'databox data'; @@ -1462,8 +1462,8 @@ class DiscoveryTaskList extends HTML $table->data[$i++][1] .= ''; } else if ((int) $task['type'] === DISCOVERY_EXTENSION) { // Content. + $countSummary = 1; if (is_array($task['stats']) === true) { - $countSummary = 1; foreach ($task['stats'] as $key => $summary) { $table->data[$i][0] = ''.__('Summary').' '.$countSummary.''; $table->data[$i][1] = ''; @@ -1508,6 +1508,13 @@ class DiscoveryTaskList extends HTML $i++; } } + } else { + $table->data[$i][0] = ''.__('Summary').''; + $table->data[$i][1] = ''; + $i++; + $table->data[$i][0] = $task['summary']; + $table->data[$i][1] = ''; + $i++; } } else { // Content. diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index e4aa1b1143..a379dc574e 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -893,6 +893,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` ( `snmp_skip_non_enabled_ifs` TINYINT UNSIGNED DEFAULT 1, `id_app` int(10), `setup_complete` tinyint unsigned NOT NULL DEFAULT 0, + `executions_timeout` int unsigned NOT NULL DEFAULT 60, PRIMARY KEY (`id_rt`), KEY `recon_task_daemon` (`id_recon_server`), FOREIGN KEY (`id_app`) REFERENCES tdiscovery_apps(`id_app`) ON DELETE CASCADE ON UPDATE CASCADE