}
/**
+ * Remove one or more history entries by parent.
+ *
+ * @param string $parent The parent name to remove.
+ *
+ * @throws Horde_Exception
+ */
+ public function removeByParent($parent)
+ {
+ /* Remove entries 100 at a time. */
+ $all = array_keys($this->getByTimestamp('>', 0, array(), $parent));
+
+ while (count($d = array_splice($all, 0, 100)) > 0) {
+ $this->removebyNames($d);
+ }
+ }
+
+ /**
* Remove one or more history entries by name.
*
* @param array $names The history entries to remove.
/* Now delete history as well. */
$history = Horde_History::singleton();
- if (method_exists($history, 'removeByParent')) {
- $histories = $history->removeByParent('kronolith:' . $user);
- } else {
- /* Remove entries 100 at a time. */
- $all = $history->getByTimestamp('>', 0, array(), 'kronolith:' . $user);
- if (is_a($all, 'PEAR_Error')) {
- Horde::logMessage($all, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $all = array_keys($all);
- while (count($d = array_splice($all, 0, 100)) > 0) {
- $history->removebyNames($d);
- }
- }
- }
+ $histories = $history->removeByParent('kronolith:' . $user);
if (is_a($result, 'PEAR_Error')) {
return $result;
/* Now delete history as well. */
$history = Horde_History::singleton();
- if (method_exists($history, 'removeByParent')) {
- $histories = $history->removeByParent('nag:' . $user);
- } else {
- /* Remove entries 100 at a time. */
- $all = $history->getByTimestamp('>', 0, array(), 'nag:' . $user);
- if (is_a($all, 'PEAR_Error')) {
- Horde::logMessage($all, __FILE__, __LINE__, PEAR_LOG_ERR);
- } else {
- $all = array_keys($all);
- while (count($d = array_splice($all, 0, 100)) > 0) {
- $history->removebyNames($d);
- }
- }
- }
+ $histories = $history->removeByParent('nag:' . $user);
/* ...and finally, delete the actual share */
if (!empty($share)) {