#9771 remove table tdiscovery_apps_tasks from list task
This commit is contained in:
parent
59271429b3
commit
8e2bcc5651
|
@ -163,10 +163,7 @@ class DiscoveryTaskList extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_reporting_console_node() === false) {
|
if (is_reporting_console_node() === false) {
|
||||||
$ret2 = $this->showList(__('Host & devices tasks'), [0, 1]);
|
$ret2 = $this->showList();
|
||||||
$ret2 .= $this->showList(__('Applications tasks'), [3, 4, 5, 10, 11, 12], 'app');
|
|
||||||
$ret2 .= $this->showList(__('Cloud tasks'), [6, 7, 8, 13, 14], 'cloud');
|
|
||||||
$ret2 .= $this->showList(__('Custom tasks'), [-1], 'custom');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ret === false && $ret2 === false) {
|
if ($ret === false && $ret2 === false) {
|
||||||
|
@ -249,23 +246,8 @@ class DiscoveryTaskList extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
$task = get_parameter('task', null);
|
$task = get_parameter('task', null);
|
||||||
$extension = get_parameter('extension', null);
|
|
||||||
|
|
||||||
if ($task !== null) {
|
if ($task !== null) {
|
||||||
if ($extension !== null) {
|
|
||||||
$result = db_process_sql_delete(
|
|
||||||
'tdiscovery_apps_tasks',
|
|
||||||
['id_task' => $task]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result == 1) {
|
|
||||||
return [
|
|
||||||
'result' => 0,
|
|
||||||
'msg' => __('Task successfully deleted'),
|
|
||||||
'id' => false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_delete(
|
$result = db_process_sql_delete(
|
||||||
'trecon_task',
|
'trecon_task',
|
||||||
['id_rt' => $task]
|
['id_rt' => $task]
|
||||||
|
@ -278,7 +260,6 @@ class DiscoveryTaskList extends HTML
|
||||||
'id' => false,
|
'id' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Trick to avoid double execution.
|
// Trick to avoid double execution.
|
||||||
header('Location: '.$this->url);
|
header('Location: '.$this->url);
|
||||||
|
@ -453,24 +434,8 @@ class DiscoveryTaskList extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
$task = get_parameter('task', null);
|
$task = get_parameter('task', null);
|
||||||
$extension = get_parameter('extension', null);
|
|
||||||
|
|
||||||
if ($task !== null) {
|
if ($task !== null) {
|
||||||
if ($extension !== null) {
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'tdiscovery_apps_tasks',
|
|
||||||
['disabled' => 1],
|
|
||||||
['id_task' => $task]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result == 1) {
|
|
||||||
return [
|
|
||||||
'result' => 0,
|
|
||||||
'msg' => __('Task successfully disabled'),
|
|
||||||
'id' => false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_update(
|
$result = db_process_sql_update(
|
||||||
'trecon_task',
|
'trecon_task',
|
||||||
['disabled' => 1],
|
['disabled' => 1],
|
||||||
|
@ -484,7 +449,6 @@ class DiscoveryTaskList extends HTML
|
||||||
'id' => false,
|
'id' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Trick to avoid double execution.
|
// Trick to avoid double execution.
|
||||||
header('Location: '.$this->url);
|
header('Location: '.$this->url);
|
||||||
|
@ -512,24 +476,8 @@ class DiscoveryTaskList extends HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
$task = get_parameter('task', null);
|
$task = get_parameter('task', null);
|
||||||
$extension = get_parameter('extension', null);
|
|
||||||
|
|
||||||
if ($task !== null) {
|
if ($task !== null) {
|
||||||
if ($extension !== null) {
|
|
||||||
$result = db_process_sql_update(
|
|
||||||
'tdiscovery_apps_tasks',
|
|
||||||
['disabled' => 0],
|
|
||||||
['id_task' => $task]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($result == 1) {
|
|
||||||
return [
|
|
||||||
'result' => 0,
|
|
||||||
'msg' => __('Task successfully enabled'),
|
|
||||||
'id' => false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_update(
|
$result = db_process_sql_update(
|
||||||
'trecon_task',
|
'trecon_task',
|
||||||
[
|
[
|
||||||
|
@ -546,7 +494,6 @@ class DiscoveryTaskList extends HTML
|
||||||
'id' => false,
|
'id' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Trick to avoid double execution.
|
// Trick to avoid double execution.
|
||||||
header('Location: '.$this->url);
|
header('Location: '.$this->url);
|
||||||
|
@ -558,13 +505,9 @@ class DiscoveryTaskList extends HTML
|
||||||
/**
|
/**
|
||||||
* Show complete list of running tasks.
|
* Show complete list of running tasks.
|
||||||
*
|
*
|
||||||
* @param string $titleTable Title of section.
|
|
||||||
* @param array $filter Ids array from apps for filter.
|
|
||||||
* @param boolean $extensionSection Extension to add in table.
|
|
||||||
*
|
|
||||||
* @return boolean Success or not.
|
* @return boolean Success or not.
|
||||||
*/
|
*/
|
||||||
public function showList($titleTable, $filter, $extensionSection=false)
|
public function showList()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -588,30 +531,7 @@ class DiscoveryTaskList extends HTML
|
||||||
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
include_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||||
|
|
||||||
if (users_is_admin()) {
|
if (users_is_admin()) {
|
||||||
$recon_tasks = db_get_all_rows_sql(
|
$recon_tasks = db_get_all_rows_sql('SELECT * FROM trecon_task');
|
||||||
sprintf(
|
|
||||||
'SELECT * FROM trecon_task WHERE type IN (%s)',
|
|
||||||
implode(',', $filter)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($recon_tasks === false) {
|
|
||||||
$recon_tasks = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$recon_tasks_discovery = db_get_all_rows_sql(
|
|
||||||
sprintf(
|
|
||||||
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
|
|
||||||
FROM tdiscovery_apps_tasks tasks
|
|
||||||
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
|
|
||||||
WHERE section = "%s"',
|
|
||||||
$extensionSection
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($recon_tasks_discovery === false) {
|
|
||||||
$recon_tasks_discovery = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$recon_tasks = array_merge($recon_tasks, $recon_tasks_discovery);
|
|
||||||
} else {
|
} else {
|
||||||
$user_groups = implode(
|
$user_groups = implode(
|
||||||
',',
|
',',
|
||||||
|
@ -620,31 +540,10 @@ class DiscoveryTaskList extends HTML
|
||||||
$recon_tasks = db_get_all_rows_sql(
|
$recon_tasks = db_get_all_rows_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT * FROM trecon_task
|
'SELECT * FROM trecon_task
|
||||||
WHERE id_group IN (%s) AND
|
WHERE id_group IN (%s)',
|
||||||
type IN (%s)',
|
|
||||||
$user_groups,
|
|
||||||
implode(',', $filter)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($recon_tasks === false) {
|
|
||||||
$recon_tasks = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$recon_tasks_discovery = db_get_all_rows_sql(
|
|
||||||
sprintf(
|
|
||||||
'SELECT tasks.*, apps.section AS section, apps.short_name AS short_name
|
|
||||||
FROM tdiscovery_apps_tasks tasks
|
|
||||||
LEFT JOIN tdiscovery_apps apps ON tasks.id_app = apps.id_app
|
|
||||||
WHERE section = "%s" AND id_group IN (%s)',
|
|
||||||
$extensionSection,
|
|
||||||
$user_groups
|
$user_groups
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($recon_tasks_discovery === false) {
|
|
||||||
$recon_tasks_discovery = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$recon_tasks = array_merge($recon_tasks, $recon_tasks_discovery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show network tasks for Recon Server.
|
// Show network tasks for Recon Server.
|
||||||
|
@ -810,16 +709,10 @@ class DiscoveryTaskList extends HTML
|
||||||
|
|
||||||
$data[2] = $server_name;
|
$data[2] = $server_name;
|
||||||
|
|
||||||
if ($task['interval_sweep'] > 0 || $task['interval'] > 0) {
|
if ($task['interval_sweep'] > 0) {
|
||||||
if (empty($task['interval']) === false) {
|
|
||||||
$data[3] = human_time_description_raw(
|
|
||||||
$task['interval']
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$data[3] = human_time_description_raw(
|
$data[3] = human_time_description_raw(
|
||||||
$task['interval_sweep']
|
$task['interval_sweep']
|
||||||
);
|
);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$data[3] = __('Manual');
|
$data[3] = __('Manual');
|
||||||
}
|
}
|
||||||
|
@ -952,7 +845,7 @@ class DiscoveryTaskList extends HTML
|
||||||
|
|
||||||
case DISCOVERY_HOSTDEVICES:
|
case DISCOVERY_HOSTDEVICES:
|
||||||
default:
|
default:
|
||||||
if (empty($task['id_recon_script']) === false && (int) $task['id_recon_script'] === 0) {
|
if ($task['id_recon_script'] == 0) {
|
||||||
// Discovery NetScan.
|
// Discovery NetScan.
|
||||||
$data[6] = html_print_image(
|
$data[6] = html_print_image(
|
||||||
'images/cluster@os.svg',
|
'images/cluster@os.svg',
|
||||||
|
@ -963,13 +856,6 @@ class DiscoveryTaskList extends HTML
|
||||||
]
|
]
|
||||||
).' ';
|
).' ';
|
||||||
$data[6] .= __('Discovery.NetScan');
|
$data[6] .= __('Discovery.NetScan');
|
||||||
} else if (empty($task['id_app']) === false) {
|
|
||||||
$data[6] = html_print_image(
|
|
||||||
'images/plugins@svg.svg',
|
|
||||||
true,
|
|
||||||
['class' => 'main_menu_icon invert_filter']
|
|
||||||
).' ';
|
|
||||||
$data[6] .= $task['short_name'];
|
|
||||||
} else {
|
} else {
|
||||||
// APP or external script recon task.
|
// APP or external script recon task.
|
||||||
$data[6] = html_print_image(
|
$data[6] = html_print_image(
|
||||||
|
@ -1035,7 +921,6 @@ class DiscoveryTaskList extends HTML
|
||||||
$data[9] .= '</a>';
|
$data[9] .= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($task['id_app']) === true) {
|
|
||||||
$data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
$data[9] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||||
$data[9] .= html_print_image(
|
$data[9] .= html_print_image(
|
||||||
'images/details.svg',
|
'images/details.svg',
|
||||||
|
@ -1047,7 +932,6 @@ class DiscoveryTaskList extends HTML
|
||||||
);
|
);
|
||||||
$data[9] .= '</a>';
|
$data[9] .= '</a>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
|
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
|
||||||
&& $task['type'] != DISCOVERY_APP_MYSQL
|
&& $task['type'] != DISCOVERY_APP_MYSQL
|
||||||
|
@ -1114,33 +998,6 @@ class DiscoveryTaskList extends HTML
|
||||||
]
|
]
|
||||||
).'</a>';
|
).'</a>';
|
||||||
}
|
}
|
||||||
} else if (empty($task['id_app']) === false) {
|
|
||||||
// Check if is a H&D, Cloud or Application or IPAM.
|
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
|
||||||
sprintf(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=%s&mode=%s&id_task=%s',
|
|
||||||
$task['section'],
|
|
||||||
$task['short_name'],
|
|
||||||
$task['id_task'],
|
|
||||||
)
|
|
||||||
).'">'.html_print_image(
|
|
||||||
'images/edit.svg',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('Edit task'),
|
|
||||||
'class' => 'main_menu_icon invert_filter',
|
|
||||||
]
|
|
||||||
).'</a>';
|
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
|
||||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&extension=1&delete=1&task='.$task['id_task']
|
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
|
||||||
'images/delete.svg',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'title' => __('Delete task'),
|
|
||||||
'class' => 'main_menu_icon invert_filter',
|
|
||||||
]
|
|
||||||
).'</a>';
|
|
||||||
} else {
|
} else {
|
||||||
// Check if is a H&D, Cloud or Application or IPAM.
|
// Check if is a H&D, Cloud or Application or IPAM.
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
|
@ -1169,14 +1026,9 @@ class DiscoveryTaskList extends HTML
|
||||||
).'</a>';
|
).'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$url_disabled = 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&task='.$task['id_rt'];
|
|
||||||
if (empty($task['id_app']) === false) {
|
|
||||||
$url_disabled = 'index.php?sec=gservers&sec2=godmode/servers/discovery&extension=1&wiz=tasklist&task='.$task['id_task'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($task['disabled'] == 1) {
|
if ($task['disabled'] == 1) {
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
$url_disabled.'&enabled=1'
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&enabled=1&wiz=tasklist&task='.$task['id_rt']
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||||
'images/lightbulb_off.png',
|
'images/lightbulb_off.png',
|
||||||
true,
|
true,
|
||||||
|
@ -1187,7 +1039,7 @@ class DiscoveryTaskList extends HTML
|
||||||
).'</a>';
|
).'</a>';
|
||||||
} else if ($task['disabled'] == 0) {
|
} else if ($task['disabled'] == 0) {
|
||||||
$data[9] .= '<a href="'.ui_get_full_url(
|
$data[9] .= '<a href="'.ui_get_full_url(
|
||||||
$url_disabled.'&disabled=1'
|
'index.php?sec=gservers&sec2=godmode/servers/discovery&disabled=1&wiz=tasklist&task='.$task['id_rt']
|
||||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||||
'images/lightbulb.png',
|
'images/lightbulb.png',
|
||||||
true,
|
true,
|
||||||
|
@ -1217,7 +1069,7 @@ class DiscoveryTaskList extends HTML
|
||||||
$return = true;
|
$return = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_toggle($content, $titleTable, '', '', false);
|
ui_toggle($content, __('Server Tasks'), '', '', false);
|
||||||
|
|
||||||
// Div neccesary for modal map task.
|
// Div neccesary for modal map task.
|
||||||
echo '<div id="map_task" class="invisible"></div>';
|
echo '<div id="map_task" class="invisible"></div>';
|
||||||
|
|
Loading…
Reference in New Issue