2013-09-30 Sergio Martin <sergio.martin@artica.es>

* include/functions_config.php: Improve the db maintenance check
	to avoid heavy tsesion queries each page load



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8833 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-09-30 13:57:48 +00:00
parent f4c2ae0ea8
commit ddf047cd90
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2013-09-30 Sergio Martin <sergio.martin@artica.es>
* include/functions_config.php: Improve the db maintenance check
to avoid heavy tsesion queries each page load
2013-09-30 Miguel de Dios <miguel.dedios@artica.es>
* index.php: fixed the check login parameter.

View File

@ -1151,15 +1151,16 @@ function config_check () {
// Check database maintance
$db_maintance = db_get_value_filter ('value', 'tconfig', array('token' => 'db_maintance'));
$now = date("U");
// First action in order to know if it's a new installation or db maintenance never have been executed
$first_action = db_get_value_filter('utimestamp', 'tsesion', array('1 = 1', 'order' => 'id_sesion ASC'));
$fresh_installation = $now - $first_action;
// If never was executed, it means we are in the first Pandora FMS execution. Set current timestamp
if(empty($db_maintance)) {
config_update_value ('db_maintance', date("U"));
}
$resta = $now - $db_maintance;
$last_maintance = date("U") - $db_maintance;
// ~ about 50 hr
if (($resta > 190000 AND $fresh_installation> 190000)){
if ($last_maintance > 190000){
$config["alert_cnt"]++;
$_SESSION["alert_msg"] .= ui_print_error_message(
array('title' => __("Database maintance problem"),