$data = $this->fetch_node();
$data = $data['history'];
- if (sizeof($data['history']) < 1)
+ if (sizeof($data) < 1)
{
return $this->fetch_revision(0);
}
- unset($data[ max(array_keys($data)) ]);
+ $list = array_keys($data);
+
+ $key = array_search($revision, $list);
+ $key++; // go to the next earliest revision
+ if (!isset($list["$key"]))
+ {
+ return -1;
+ }
- return $this->fetch_revision(max(array_keys($data)));
+ return $this->fetch_revision($list["$key"]);
}
// ###################################################################