Project

General

Profile

Bug #2651 » rrd.inc.patch

patch for rrd.inc - Norman Back, 10/25/2012 04:18 PM

View differences:

/tmp/rrd.inc 2012-10-25 21:58:33.514423782 +0100
$rowcountold = count($rrdoldxml['rra'][$i]['database']['row']);
$rowcountnew = count($rrdnewxml['rra'][$i]['database']['row']);
$rowcountdiff = $rowcountnew - $rowcountold;
/* save old rows for a bit before we put the required empty rows before it */
$rowsdata = $rows;
$rowsempty = array();
$r = 0;
while($r < $rowcountdiff) {
$rowsempty[] = $rrdnewxml['rra'][$i]['database']['row'][$r];
$r++;
if($rowcountdiff < 0){
/* remove excess rows */
$r = - $rowcountdiff;
$rrdoldxml['rra'][$i]['database']['row'] = array_slice($rrdoldxml['rra'][$i]['database']['row'],$r);
$rowcountold = count($rrdoldxml['rra'][$i]['database']['row']);
if($rowcountold == $rowcountnew){
log_error(sprintf("Row count successfully reduced by $r to $rowcountold\n"));
}
}
elseif($rowcountdiff > 0) {
/* save old rows for a bit before we put the required empty rows before it */
$rowsdata = $rows;
$rowsempty = array();
$r = 0;
while($r < $rowcountdiff) {
$rowsempty[] = $rrdnewxml['rra'][$i]['database']['row'][$r];
$r++;
}
$rows = $rowsempty + $rowsdata;
}
$rows = $rowsempty + $rowsdata;
/* now foreach the rows in the database */
foreach($rows['row'] as $row) {
if(!is_array($rrdoldxml['rra'][$i]['database']['row'][$k])) {
(1-1/2)