fix: page/graph load speed: part 1 (#6611)

* fix: page/graph load speed: part 1
Speed up load_all_os() by caching the full $config['os'] array
Function time goes from 1.13648s -> 0.00073s
The cache is updated during discovery, but only if it is >22hrs old.
Additionally, the cache is not used and a full yaml load is forced if the cache is >24hrs old.
The cache time is controlled by $config['os_def_cache_time'], I don't see any reason anyone would change that time.

* Delete Session.php

* Include the cache directory.
This commit is contained in:
Tony Murray
2017-05-10 02:57:10 -05:00
committed by Neil Lathwood
parent d60c43ed8d
commit b6e18db766
6 changed files with 66 additions and 25 deletions

View File

@@ -152,12 +152,8 @@ if (module_selected('web', $init_modules)) {
$config['title_image'] = 'images/librenms_logo_'.$config['site_style'].'.svg';
}
require $install_dir . '/html/includes/vars.inc.php';
$tmp_list = dbFetchRows('SELECT DISTINCT(`os`) FROM `devices`');
$os_list = array();
foreach ($tmp_list as $k => $v) {
$os_list[] = $config['install_dir'].'/includes/definitions/'. $v['os'] . '.yaml';
}
load_all_os($os_list);
load_all_os(true);
}
$console_color = new Console_Color2();