mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
#10259 create control for token agentaccess if agents morte than 200
This commit is contained in:
parent
e1d550142c
commit
aaae7454fa
@ -151,6 +151,9 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total_agents = db_get_value('count(*)', 'tagente');
|
||||||
|
$disable_agentaccess = ($total_agents >= 200) ? true : false;
|
||||||
|
|
||||||
$table_status = new StdClass();
|
$table_status = new StdClass();
|
||||||
$table_status->width = '100%';
|
$table_status->width = '100%';
|
||||||
$table_status->class = 'databox filters';
|
$table_status->class = 'databox filters';
|
||||||
@ -577,7 +580,7 @@ $table_other->data[$i++][1] = html_print_input_text(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$table_other->data[$i][0] = __('Use agent access graph');
|
$table_other->data[$i][0] = __('Use agent access graph');
|
||||||
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true, $disable_agentaccess);
|
||||||
|
|
||||||
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
|
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
|
||||||
$table_other->data[$i++][1] = html_print_input_text(
|
$table_other->data[$i++][1] = html_print_input_text(
|
||||||
|
@ -258,6 +258,11 @@ class ConsoleSupervisor
|
|||||||
$this->checkSyncQueueStatus();
|
$this->checkSyncQueueStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check number of agents is equals and more than 200.
|
||||||
|
* NOTIF.ACCESSSTASTICS.PERFORMANCE
|
||||||
|
*/
|
||||||
|
$this->checkAccessStatisticsPerformance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -518,6 +523,12 @@ class ConsoleSupervisor
|
|||||||
$this->checkSyncQueueLength();
|
$this->checkSyncQueueLength();
|
||||||
$this->checkSyncQueueStatus();
|
$this->checkSyncQueueStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check number of agents is equals and more than 200.
|
||||||
|
* NOTIF.ACCESSSTASTICS.PERFORMANCE
|
||||||
|
*/
|
||||||
|
$this->checkAccessStatisticsPerformance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -532,6 +543,34 @@ class ConsoleSupervisor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check number of agents and disable agentaccess token if number
|
||||||
|
* is equals and more than 200.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function checkAccessStatisticsPerformance()
|
||||||
|
{
|
||||||
|
$total_agents = db_get_value('count(*)', 'tagente');
|
||||||
|
|
||||||
|
if ($total_agents >= 200) {
|
||||||
|
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
|
||||||
|
$this->notify(
|
||||||
|
[
|
||||||
|
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
|
||||||
|
'title' => __('Access statistics performance'),
|
||||||
|
'message' => __(
|
||||||
|
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
|
||||||
|
),
|
||||||
|
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->cleanNotifications('NOTIF.ACCESSSTASTICS.PERFORMANCE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update targets for given notification using object targets.
|
* Update targets for given notification using object targets.
|
||||||
*
|
*
|
||||||
|
@ -159,6 +159,7 @@ function notifications_get_subtypes(?string $source=null)
|
|||||||
'NOTIF.SERVER.STATUS',
|
'NOTIF.SERVER.STATUS',
|
||||||
'NOTIF.SERVER.QUEUE',
|
'NOTIF.SERVER.QUEUE',
|
||||||
'NOTIF.SERVER.MASTER',
|
'NOTIF.SERVER.MASTER',
|
||||||
|
'NOTIF.ACCESSSTASTICS.PERFORMANCE',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user