Avoid to execute non cron complianced modules on creation

Former-commit-id: edfb13175ca00bc5aee99609c0eec30e06d5936e
This commit is contained in:
Fermin 2019-03-29 15:06:26 +01:00
parent 05ce178854
commit 4fd3aa3a51
2 changed files with 11 additions and 8 deletions

View File

@ -20,15 +20,17 @@ function cron_update_module_interval($module_id, $cron)
{
// Check for a valid cron.
if (!cron_check_syntax($cron)) {
return;
return false;
}
if ($cron == '* * * * *') {
$module_interval = db_get_value_filter(
'module_interval',
'tagente_modulo',
['id_agente_modulo' => $module_id]
);
$module_interval = db_get_value(
'module_interval',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
if ($cron === '* * * * *') {
return db_process_sql(
'UPDATE tagente_estado SET current_interval = '.$module_interval.' WHERE id_agente_modulo = '.(int) $module_id
);

View File

@ -663,10 +663,11 @@ function modules_create_agent_module(
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'utimestamp' => (time() - (int) $values['interval']),
'status_changes' => 0,
'last_status' => $status,
'last_known_status' => $status,
'current_interval' => (int) $values['interval'],
]
);