24 $statdir = $this->statconfig->getValue(
'statdir');
25 $statrules = $this->statconfig->getValue(
'statrules');
26 $timeres = $this->statconfig->getValue(
'timeres');
31 if (!is_dir($statdir)) {
32 throw new Exception(
'Statisics output directory [' . $statdir .
'] does not exists.');
34 $filelist = scandir($statdir);
35 $this->available = array();
36 foreach ($filelist as $file) {
37 if (preg_match(
'/([a-z0-9_]+)-([a-z0-9_]+)-([0-9]+)\.stat/', $file, $matches)) {
38 if (array_key_exists($matches[1], $statrules)) {
39 if (array_key_exists($matches[2],
$timeres))
40 $this->available[$matches[1]][$matches[2]][] = $matches[3];
44 if (empty($this->available)) {
45 throw new Exception(
'No aggregated statistics files found in [' . $statdir .
']');
51 $this->availrules = array_keys($statrules);
52 $available_rules = array();
53 foreach ($this->availrules as
$key) {
54 $available_rules[
$key] = array(
'name' => $statrules[$key][
'name'],
'descr' => $statrules[$key][
'descr']);
56 $this->availrulenames = $available_rules;
74 $rule = $this->statconfig->getString(
'default', $this->availrules[0]);
76 if (in_array(
$preferRule, $this->availrules,
true)) {
86 $statrulesConfig = $this->statconfig->getConfigItem(
'statrules');
87 $statruleConfig = $statrulesConfig->getConfigItem(
$rule);
90 $statrule =
new $presenterClass($this->statconfig, $statruleConfig,
$rule, $this->available);
__construct($statconfig)
Constructor.
static resolveClass($id, $type, $subclass=null)
Resolve module class.
resolveSelectedRule($preferRule=null)
Resolve which rule is selected.