Added the function "db_search_in_history_db"

This commit is contained in:
Alejandro Gallardo Escobar 2014-10-22 11:52:54 +02:00
parent 2b890a7beb
commit fc5cfb3c32
1 changed files with 21 additions and 0 deletions

View File

@ -1187,4 +1187,25 @@ function db_get_fields($table) {
break;
}
}
/**
* @param int Unix timestamp with the date.
*
* @return bool Returns true if the history db has data after the date provided or false otherwise.
*/
function db_search_in_history_db ($utimestamp) {
global $config;
$search_in_history_db = false;
if ($config['history_db_enabled'] == 1) {
$history_db_start_period = $config['history_db_days'] * SECONDS_1DAY;
// If the date is newer than the newest history db data
if (time() - $history_db_start_period >= $utimestamp)
$search_in_history_db = true;
}
return $search_in_history_db;
}
?>