* function is called.
*
* @param DataTreeObject_Group $group The new group object.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function addGroup($group)
{
}
/* Log the addition of the group in the history log. */
- $history = &Horde_History::singleton();
- $log = $history->log($this->getGUID($group), array('action' => 'add'), true);
- if (is_a($log, 'PEAR_Error')) {
- return $log;
- }
+ Horde_History::singleton()->log($this->getGUID($group), array('action' => 'add'), true);
return $result;
}
* Stores updated data - users, etc. - of a group to the backend system.
*
* @param DataTreeObject_Group $group The group to update.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function updateGroup($group)
{
$this->_groupCache[$group->getName()] = &$group;
/* Log the update of the group users on the history log. */
- $history = &Horde_History::singleton();
+ $history = Horde_History::singleton();
$guid = $this->getGUID($group);
foreach ($group->getAuditLog() as $userId => $action) {
$history->log($guid, array('action' => $action, 'user' => $userId), true);
*
* @param DataTreeObject_Group $group The group to remove.
* @param boolean $force Force to remove every child.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function removeGroup($group, $force = false)
{
}
unset($this->_groupCache[$group->getName()]);
- $history = &Horde_History::singleton();
- $history->log($this->getGUID($group), array('action' => 'delete'), true);
+ Horde_History::singleton()->log($this->getGUID($group), array('action' => 'delete'), true);
return $this->_datatree->remove($group, $force);
}
* @param LDAP_Object $group The group to update
*
* @return mixed True on success, PEAR_Error otherwise.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function updateGroup($group)
{
@ldap_close($this->_ds);
/* Log the update of the group users on the history log. */
- $history = &Horde_History::singleton();
+ $history = Horde_History::singleton();
$guid = $this->getGUID($group);
foreach ($group->getAuditLog() as $userId => $action) {
$history->log($guid, array('action' => $action, 'user' => $userId), true);
* function is called.
*
* @param SQLObject_Group $group The new group object.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function addGroup(&$group)
{
}
/* Log the addition of the group in the history log. */
- $history = &Horde_History::singleton();
- $log = $history->log($this->getGUID($group), array('action' => 'add'), true);
- if (is_a($log, 'PEAR_Error')) {
- return $log;
- }
+ $history = Horde_History::singleton();
+ $history->log($this->getGUID($group), array('action' => 'add'), true);
return $result;
}
* Stores updated data - users, etc. - of a group to the backend system.
*
* @param SQLObject_Group $group The group to update.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function updateGroup($group)
{
$this->_groupCache[$group->getName()] = &$group;
/* Log the update of the group users on the history log. */
- $history = &Horde_History::singleton();
+ $history = Horde_History::singleton();
$guid = $this->getGUID($group);
foreach ($group->getAuditLog() as $userId => $action) {
$history->log($guid, array('action' => $action, 'user' => $userId), true);
*
* @param SQLObject_Group $group The group to remove.
* @param boolean $force Force to remove every child.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
function removeGroup($group, $force = false)
{
}
unset($this->_groupCache[$name]);
- $history = &Horde_History::singleton();
- $history->log($this->getGUID($group), array('action' => 'delete'), true);
+ Horde_History::singleton()->log($this->getGUID($group), array('action' => 'delete'), true);
$query = 'DELETE FROM horde_groups_members WHERE group_uid = ?';
$result = $this->_write_db->query($query, array($id));
/* Log the action on this item in the history log. */
try {
- $history = &Horde_History::singleton();
-
- $history_id = $app . ':' . $this->_folder->getShareId() . ':' . $object_uid;
- $history->log($history_id, array('action' => $action, 'ts' => $mod_ts),
- true);
+ Horde_History::singleton()
+ ->log($app . ':' . $this->_folder->getShareId() . ':' . $object_uid,
+ array('action' => $action, 'ts' => $mod_ts),
+ true);
} catch (Horde_Exception $e) {
}
}
try {
$history->log(self::_getUniqueHistoryId($val), $params);
- } catch (Horde_Exception $e) {
+ } catch (Exception $e) {
/* On error, log the error message only since informing the
* user is just a waste of time and a potential point of
* confusion, especially since they most likely don't even
*
* @param string $msg_id The Message-ID of the message.
*
- * @return DataTreeObject The DataTreeObject object containing the log
- * information.
+ * @return Horde_History_Log The object containing the log information.
* @throws Horde_Exception
*/
static public function getLog($msg_id)
}
if ($msg_history) {
- foreach ($msg_history->getData() as $entry) {
+ foreach ($msg_history as $entry) {
if (($entry['action'] == 'mdn') && ($entry['type'] == $type)) {
return true;
}
$tf = $GLOBALS['prefs']->getValue('time_format');
$ret = array();
- foreach ($msg_history->getData() as $entry) {
+ foreach ($msg_history as $entry) {
$msg = null;
if (isset($entry['desc'])) {
$msg_ids = array_map(array('IMP_Maillog', '_getUniqueHistoryId'), $msg_ids);
$history = Horde_History::singleton();
- return $history->removeByNames($msg_ids);
+ $history->removeByNames($msg_ids);
}
/**
$existing_event = $kronolith_driver->getByUID($uid, array($calendar));
// Check if our event is newer then the existing - get
// the event's history.
- $history = Horde_History::singleton();
$created = $modified = null;
- $log = $history->getHistory('kronolith:' . $calendar . ':' . $uid);
try {
- if ($log) {
- foreach ($log->getData() as $entry) {
- switch ($entry['action']) {
- case 'add':
- $created = $entry['ts'];
- break;
-
- case 'modify':
- $modified = $entry['ts'];
- break;
- }
+ $log = Horde_History::singleton()->getHistory('kronolith:' . $calendar . ':' . $uid);
+ foreach ($log as $entry) {
+ switch ($entry['action']) {
+ case 'add':
+ $created = $entry['ts'];
+ break;
+
+ case 'modify':
+ $modified = $entry['ts'];
+ break;
}
}
- } catch (Exception $e) {
- }
+ } catch (Exception $e) {}
if (empty($modified) && !empty($created)) {
$modified = $created;
}
* @param string $calendar The calendar to search in.
*
* @return array An array of UIDs matching the action and time criteria.
+ *
* @throws Kronolith_Exception
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
public function listBy($action, $timestamp, $calendar = null)
{
throw new Horde_Exception_PermissionDenied();
}
- $history = Horde_History::singleton();
- $histories = $history->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'kronolith:' . $calendar);
+ $histories = Horde_History::singleton()->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'kronolith:' . $calendar);
// Strip leading kronolith:username:.
return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
* @param string $calendar The calendar to search in.
*
* @return integer The timestamp for this action.
+ *
* @throws Kronolith_Exception
+ * @throws InvalidArgumentException
*/
public function getActionTimestamp($uid, $action, $calendar = null)
{
throw new Horde_Exception_PermissionDenied();
}
- $history = Horde_History::singleton();
- return $history->getActionTimestamp('kronolith:' . $calendar . ':' .
- $uid, $action);
+ return Horde_History::singleton()->getActionTimestamp('kronolith:' . $calendar . ':' . $uid, $action);
}
/**
* @param string $user Name of user to remove data for.
*
* @throws Kronolith_Exception
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
public function removeUserData($user)
{
$result = Kronolith::getDriver()->removeUserData($user);
/* Now delete history as well. */
- $history = Horde_History::singleton();
- $histories = $history->removeByParent('kronolith:' . $user);
+ Horde_History::singleton()->removeByParent('kronolith:' . $user);
/* Get the user's default share */
try {
$uid = $event->uid;
if ($uid) {
$history = Horde_History::singleton();
- $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true);
- $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true);
+ try {
+ $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true);
+ $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
}
Kronolith::sendNotification($event, $edit ? 'edit' : 'add');
/* Log the creation/modification of this item in the history log. */
- $history = Horde_History::singleton();
- $history->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true);
+ try {
+ Horde_History::singleton()->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
// refresh IMAP cache
$this->synchronize(true);
}
/* Log the deletion of this item in the history log. */
- $history = Horde_History::singleton();
- $history->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+ try {
+ Horde_History::singleton()->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
if (is_callable('Kolab', 'triggerFreeBusyUpdate')) {
//Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar));
/* Log the modification of this item in the history log. */
if ($event->uid) {
- $history = Horde_History::singleton();
- $history->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'modify'), true);
+ try {
+ Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'modify'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Update tags */
$this->handleError($result);
/* Log the creation of this item in the history log. */
- $history = Horde_History::singleton();
- $history->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'add'), true);
+ try {
+ Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'add'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
/* Deal with any tags */
$tagger = Kronolith::getTagger();
/* Log the deletion of this item in the history log. */
if ($event->uid) {
- $history = Horde_History::singleton();
- $history->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+ try {
+ Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Remove the event from any resources that are attached to it */
$vEvent->setAttribute('UID', $this->uid);
/* Get the event's history. */
- $history = &Horde_History::singleton();
$created = $modified = null;
try {
- $log = $history->getHistory('kronolith:' . $this->calendar . ':' . $this->uid);
- if ($log) {
- foreach ($log->getData() as $entry) {
- switch ($entry['action']) {
- case 'add':
- $created = $entry['ts'];
- break;
+ $log = Horde_History::singleton()->getHistory('kronolith:' . $this->calendar . ':' . $this->uid);
+ foreach ($log as $entry) {
+ switch ($entry['action']) {
+ case 'add':
+ $created = $entry['ts'];
+ break;
- case 'modify':
- $modified = $entry['ts'];
- break;
- }
+ case 'modify':
+ $modified = $entry['ts'];
+ break;
}
}
- } catch (Exception $e) {
- }
+ } catch (Exception $e) {}
if (!empty($created)) {
$vEvent->setAttribute($v1 ? 'DCREATED' : 'CREATED', $created);
if (empty($modified)) {
* @param boolean $full Whether to return all event details.
* @param string $time_format The date() format to use for time formatting.
*
- * @return object A simple object.
+ * @return stdClass A simple object.
*/
public function toJson($allDay = null, $full = false, $time_format = 'H:i')
{
$userId = Horde_Auth::getAuth();
if ($this->event->uid) {
/* Get the event's history. */
- $history = &Horde_History::singleton();
try {
- $log = $history->getHistory('kronolith:' . $this->event->calendar . ':' .
- $this->event->uid);
- if ($log) {
- foreach ($log->getData() as $entry) {
- switch ($entry['action']) {
- case 'add':
- $created = new Horde_Date($entry['ts']);
- if ($userId != $entry['who']) {
- $createdby = sprintf(_("by %s"), Kronolith::getUserName($entry['who']));
- } else {
- $createdby = _("by me");
- }
- break;
-
- case 'modify':
- $modified = new Horde_Date($entry['ts']);
- if ($userId != $entry['who']) {
- $modifiedby = sprintf(_("by %s"), Kronolith::getUserName($entry['who']));
- } else {
- $modifiedby = _("by me");
- }
- break;
+ $log = Horde_History::singleton()
+ ->getHistory('kronolith:' . $this->event->calendar . ':' . $this->event->uid);
+ foreach ($log as $entry) {
+ switch ($entry['action']) {
+ case 'add':
+ $created = new Horde_Date($entry['ts']);
+ if ($userId != $entry['who']) {
+ $createdby = sprintf(_("by %s"), Kronolith::getUserName($entry['who']));
+ } else {
+ $createdby = _("by me");
}
+ break;
+
+ case 'modify':
+ $modified = new Horde_Date($entry['ts']);
+ if ($userId != $entry['who']) {
+ $modifiedby = sprintf(_("by %s"), Kronolith::getUserName($entry['who']));
+ } else {
+ $modifiedby = _("by me");
+ }
+ break;
}
}
- } catch (Exception $e) {
- }
+ } catch (Exception $e) {}
}
$creatorId = $this->event->creator;
// the task's history.
$history = Horde_History::singleton();
$created = $modified = null;
- $log = $history->getHistory('nag:' . $tasklist . ':' . $task->uid);
- if ($log && !is_a($log, 'PEAR_Error')) {
- foreach ($log->getData() as $entry) {
+ try {
+ $log = $history->getHistory('nag:' . $tasklist . ':' . $task->uid);
+ foreach ($log as $entry) {
switch ($entry['action']) {
case 'add':
$created = $entry['ts'];
break;
}
}
- }
+ } catch (Exception $e) {}
if (empty($modified) && !empty($add)) {
$modified = $add;
}
* user's default tasklist will be used.
*
* @return array An array of UIDs matching the action and time criteria.
+ *
+ * @throws Horde_History_Exception
+ * @throws InvalidArgumentException
*/
public function listBy($action, $timestamp, $tasklist = null)
{
return PEAR::raiseError(_("Permission Denied"));
}
- $history = Horde_History::singleton();
- $histories = $history->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'nag:' . $tasklist);
- if (is_a($histories, 'PEAR_Error')) {
- return $histories;
- }
+ $histories = Horde_History::singleton()->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'nag:' . $tasklist);
// Strip leading nag:username:.
return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
* user's default tasklist will be used.
*
* @return integer The timestamp for this action.
+ *
+ * @throws InvalidArgumentException
*/
public function getActionTimestamp($uid, $action, $tasklist = null)
{
return PEAR::raiseError(_("Permission Denied"));
}
- $history = Horde_History::singleton();
- return $history->getActionTimestamp('nag:' . $tasklist . ':' . $uid, $action);
+ return Horde_History::singleton()->getActionTimestamp('nag:' . $tasklist . ':' . $uid, $action);
}
/**
}
/* Now delete history as well. */
- $history = Horde_History::singleton();
- $histories = $history->removeByParent('nag:' . $user);
+ Horde_History::singleton()->removeByParent('nag:' . $user);
/* ...and finally, delete the actual share */
if (!empty($share)) {
/* Log the creation of this item in the history log. */
$history = Horde_History::singleton();
- $history->log('nag:' . $this->_tasklist . ':' . $uid, array('action' => 'add'), true);
+ try {
+ $history->log('nag:' . $this->_tasklist . ':' . $uid, array('action' => 'add'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
/* Log completion status changes. */
if ($completed) {
- $history->log('nag:' . $this->_tasklist . ':' . $uid, array('action' => 'complete'), true);
+ try {
+ $history->log('nag:' . $this->_tasklist . ':' . $uid, array('action' => 'complete'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Notify users about the new event. */
/* Log the moving of this item in the history log. */
if (!empty($task->uid)) {
$history = Horde_History::singleton();
- $history->log('nag:' . $task->tasklist . ':' . $task->uid, array('action' => 'delete'), true);
- $history->log('nag:' . $tasklist . ':' . $task->uid, array('action' => 'add'), true);
+ try {
+ $history->log('nag:' . $task->tasklist . ':' . $task->uid, array('action' => 'delete'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
+ try {
+ $history->log('nag:' . $tasklist . ':' . $task->uid, array('action' => 'add'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
$log_tasklist = $tasklist;
}
}
/* Log the modification of this item in the history log. */
if (!empty($task->uid)) {
- $history = Horde_History::singleton();
- $history->log('nag:' . $log_tasklist . ':' . $task->uid, array('action' => 'modify'), true);
+ try {
+ Horde_History::singleton()->log('nag:' . $log_tasklist . ':' . $task->uid, array('action' => 'modify'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Log completion status changes. */
if ($task->completed != $completed) {
- $history = Horde_History::singleton();
$attributes = array('action' => 'complete');
if (!$completed) {
$attributes['ts'] = 0;
}
- $history->log('nag:' . $log_tasklist . ':' . $task->uid, $attributes, true);
+ try {
+ Horde_History::singleton()->log('nag:' . $log_tasklist . ':' . $task->uid, $attributes, true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Notify users about the changed event. */
/* Log the deletion of this item in the history log. */
if (!empty($task->uid)) {
- $history = Horde_History::singleton();
- $history->log('nag:' . $this->_tasklist . ':' . $task->uid, array('action' => 'delete'), true);
+ try {
+ Horde_History::singleton()->log('nag:' . $this->_tasklist . ':' . $task->uid, array('action' => 'delete'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
/* Notify users about the deleted event. */
}
/* Get the task's history. */
- $history = Horde_History::singleton();
- $log = $history->getHistory('nag:' . $this->tasklist . ':' . $this->uid);
- if ($log && !is_a($log, 'PEAR_Error')) {
- foreach ($log->getData() as $entry) {
+ $created = $modified = null;
+ try {
+ $log = Horde_History::singleton()->getHistory('nag:' . $this->tasklist . ':' . $this->uid);
+ foreach ($log as $entry) {
switch ($entry['action']) {
case 'add':
$created = $entry['ts'];
break;
}
}
- }
+ } catch (Exception $e) {}
if (!empty($created)) {
$vTodo->setAttribute($v1 ? 'DCREATED' : 'CREATED', $created);
if (empty($modified)) {
foreach ($tasks as $taskId => $task) {
$log = $history->getHistory('nag:' . $tasklist . ':' . $task['uid']);
$created = false;
- foreach ($log->getData() as $entry) {
+ foreach ($log as $entry) {
if ($entry['action'] == 'add') {
$created = true;
break;
$createdby = '';
$modifiedby = '';
if (!empty($task->uid)) {
- $history = Horde_History::singleton();
- $log = $history->getHistory('nag:' . $tasklist_id . ':' . $task->uid);
- if ($log && !is_a($log, 'PEAR_Error')) {
- foreach ($log->getData() as $entry) {
+ try {
+ $log = Horde_History::singleton()->getHistory('nag:' . $tasklist_id . ':' . $task->uid);
+ foreach ($log as $entry) {
switch ($entry['action']) {
case 'add':
$created = $entry['ts'];
}
}
}
- }
+ } catch (Exception $e) {}
}
$title = $task->name;
* history.
*
* @return array An array of UIDs matching the action and time criteria.
+ *
* @throws Horde_Exception
+ * @throws InvalidArgumentException
*/
public function listBy($action, $timestamp, $sources = null)
{
}
$uids = array();
+ $history = Horde_History::singleton();
foreach ($sources as $source) {
if (empty($source) || !isset($cfgSources[$source])) {
throw new Horde_Exception(sprintf(_("Invalid address book: %s"), $source));
throw new Horde_Exception(sprintf(_("Connection failed: %s"), $driver->getMessage()));
}
- $histories = Horde_History::singleton()->getByTimestamp('>', $timestamp,
+ $histories = $history->getByTimestamp(
+ '>', $timestamp,
array(array('op' => '=',
- 'field' => 'action',
- 'value' => $action)),
+ 'field' => 'action',
+ 'value' => $action)),
'turba:' . $driver->getName());
// Strip leading turba:addressbook:.
$uids = array_merge($uids,
- str_replace('turba:' . $driver->getName() . ':',
- '',
- array_keys($histories)));
+ str_replace('turba:' . $driver->getName() . ':',
+ '',
+ array_keys($histories)));
}
return $uids;
* history.
*
* @return integer The timestamp for this action.
+ *
* @throws Horde_Exception
+ * @throws InvalidArgumentException
*/
public function getActionTimestamp($uid, $action, $sources = null)
{
}
$last = 0;
+ $history = Horde_History::singleton();
foreach ($sources as $source) {
if (empty($source) || !isset($cfgSources[$source])) {
throw new Horde_Exception(sprintf(_("Invalid address book: %s"), $source));
throw new Horde_Exception(sprintf(_("Connection failed: %s"), $driver->getMessage()));
}
- $history = Horde_History::singleton();
$ts = $history->getActionTimestamp('turba:' . $driver->getName()
. ':' . $uid,
$action);
}
/* Log the creation of this item in the history log. */
- $history = &Horde_History::singleton();
- $history->log('turba:' . $this->getName() . ':' . $uid,
+ try {
+ Horde_History::singleton()
+ ->log('turba:' . $this->getName() . ':' . $uid,
array('action' => 'add'), true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
return $key;
}
/* Log the deletion of this item in the history log. */
if ($object->getValue('__uid')) {
- $history = Horde_History::singleton();
- $history->log($object->getGuid(),
- array('action' => 'delete'), true);
+ try {
+ Horde_History::singleton()->log($object->getGuid(),
+ array('action' => 'delete'),
+ true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
return true;
/* Log the modification of this item in the history log. */
if ($object->getValue('__uid')) {
- $history = &Horde_History::singleton();
- $history->log($object->getGuid(),
- array('action' => 'modify'), true);
+ try {
+ Horde_History::singleton()->log($object->getGuid(),
+ array('action' => 'modify'),
+ true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
return $object_id;
}
}
/* Update Horde_History */
- $history = &Horde_History::singleton();
- while($ids->fetchInto($row)) {
- // This is slightly hackish, but it saves us from having to create
- // and save an array of Turba_Objects before we delete them, just to
- // be able to calculate this using Turba_Object#getGuid
- $guid = 'turba:' . $this->getName() . ':' . $row[0];
- $history->log($guid, array('action' => 'delete'), true);
+ $history = Horde_History::singleton();
+ try {
+ while ($ids->fetchInto($row)) {
+ // This is slightly hackish, but it saves us from having to
+ // create and save an array of Turba_Objects before we delete
+ // them, just to be able to calculate this using
+ // Turba_Object#getGuid
+ $guid = 'turba:' . $this->getName() . ':' . $row[0];
+ $history->log($guid, array('action' => 'delete'), true);
+ }
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
}
return true;
/* Log the adding of this item in the history again,
* because otherwise the delete log would be after the
* add log. */
- $history = Horde_History::singleton();
- $history->log('turba:' . $targetDriver->getName() . ':' . $objAttributes['__uid'],
- array('action' => 'add'), true);
+ try {
+ Horde_History::singleton()
+ ->log('turba:' . $targetDriver->getName() . ':' . $objAttributes['__uid'],
+ array('action' => 'add'),
+ true);
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
}
}
break;
/* Get the contact's history. */
if ($this->contact->getValue('__uid')) {
- $history = Horde_History::singleton();
- $log = $history->getHistory($this->contact->getGuid());
- if ($log && !is_a($log, 'PEAR_Error')) {
- foreach ($log->getData() as $entry) {
+ try {
+ $log = Horde_History::singleton()->getHistory($this->contact->getGuid());
+ foreach ($log as $entry) {
switch ($entry['action']) {
case 'add':
if ($userId != $entry['who']) {
break;
}
}
- }
+ } catch (Exception $e) {}
}
echo '<div id="Contact"' . ($active ? '' : ' style="display:none"') . '>';