44
44
const MISSING_INFO = 4; /* Return information on data gaps in interval */
46
46
function __construct(GROUPRequest &$props, READER &$reader = NULL, $flags = 0) {
47
global $DEFAULT_MISSING_VALUE;
47
49
parent::__construct($props);
49
51
$opts = &$this->req->GetOptions();
136
138
if (!isset($this->fix_missing_items['limit']))
137
139
$this->fix_missing_items['limit'] = 1;
138
140
if (!isset($this->fix_missing_items['value']))
139
$this->fix_missing_items['value'] = 0;
141
$this->fix_missing_items['value'] = NULL;
327
329
if (!sizeof($value)) continue;
329
331
if (sizeof($value) != $this->items) {
330
if ($this->ignore_invalid_data) continue;
331
throw new ADEIException(translate("Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
334
if (sizeof($value) < $this->items) {
335
if (($this->fix_missing_items)&&(sizeof($value) >= $this->fix_missing_items['limit'])) {
337
if ($this->fix_missing_items['check_growth']) {
338
/* to optimize performance we are doing really a simple
339
check here. We expect what all incomplete items are processed
340
on a first run. If then amount is changing we need to
341
regenerate CACHE tables, and this will be again first run.
342
The problems will occure only if we have interupted first run
343
and not all incomplete records are processed. We ignore that,
344
just clear cache and rerun */
347
if ($this->current_raw_end) {
349
$not_a_first_run = true;
351
if (($this->actual_items)&&(sizeof($value) < $this->actual_items))
357
$this->actual_items = sizeof($value);
358
$value = array_merge($value, array_fill(0, $this->items - sizeof($value), $this->fix_missing_items['value']));
362
if ($this->fix_extra_items) {
363
$this->actual_items = $this->items;
365
$keys = array_keys($value);
366
for ($i = sizeof($keys) - 1;$i >= $this->items; $i--) {
367
unset($value[$keys[$i]]);
374
if ($this->ignore_invalid_data) continue;
375
if ($not_a_first_run)
376
throw new ADEIException(translate("CACHE configuration accepts missing items only on a first run. Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
378
throw new ADEIException(translate("Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
380
} else $this->actual_items = $this->items;
334
382
$curdata->PushValue($value, $time - $pretime);
390
440
if ($this->ignore_invalid_data) continue;
391
throw new ADEIException(translate("Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
441
if ($not_a_first_run)
442
throw new ADEIException(translate("CACHE configuration accepts missing items only on a first run. Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
444
throw new ADEIException(translate("Number of items in the group have changed from %u to %u (CACHE::Fill)", $this->items, sizeof($value)));
393
446
} else $this->actual_items = $this->items;