Overview

Packages

  • History

Classes

  • Horde_History
  • Horde_History_Exception
  • Horde_History_Log
  • Horde_History_Mock
  • Horde_History_Sql
  • Overview
  • Package
  • Class
  • Tree

Class Horde_History

The Horde_History:: class provides a method of tracking changes in Horde objects, stored in a SQL table.

Copyright 2003-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Direct known subclasses

Horde_History_Mock, Horde_History_Sql
Abstract
Package: History
Category: Horde
License: LGPL 2.1
Author: Chuck Hagenbuch chuck@horde.org
Author: Gunnar Wrobel wrobel@pardus.de
Link: http://pear.horde.org/index.php?package=History
Located at Horde/History.php
Methods summary
public
# __construct( string $auth )

Constructor.

Constructor.

Parameters

$auth
The current user.
public null
# setLogger( Horde_Log_Logger $logger )

Set the log handler.

Set the log handler.

Parameters

$logger
The log handler.

Returns

null
public
# log( string $guid, array $attributes = array(), boolean $replaceAction = false )

Logs an event to an item's history log.

Logs an event to an item's history log.

The item must be uniquely identified by $guid. Any other details about the event are passed in $attributes. Standard suggested attributes are: - who: The id of the user that performed the action (will be added automatically if not present). - ts: Timestamp of the action (this will be added automatically if it is not present).

Parameters

$guid
<p>The unique identifier of the entry to add to.</p>
$attributes
<p>The hash of name => value entries that describe this event.</p>
$replaceAction
<p>If $attributes['action'] is already present in the item's history log, update that entry instead of creating a new one.</p>

Throws

Horde_History_Exception
public Horde_History_Log
# getHistory( string $guid )

Returns a Horde_History_Log corresponding to the named history entry, with the data retrieved appropriately.

Returns a Horde_History_Log corresponding to the named history entry, with the data retrieved appropriately.

Parameters

$guid
The name of the history entry to retrieve.

Returns

Horde_History_Log
A Horde_History_Log object.

Throws

Horde_History_Exception
abstract public Horde_History_Log
# _getHistory( string $guid )

Returns a Horde_History_Log corresponding to the named history entry, with the data retrieved appropriately.

Returns a Horde_History_Log corresponding to the named history entry, with the data retrieved appropriately.

Parameters

$guid
The name of the history entry to retrieve.

Returns

Horde_History_Log
A Horde_History_Log object.
public array
# getByTimestamp( string $cmp, integer $ts, array $filters = array(), string $parent = null )

Finds history objects by timestamp, and optionally filter on other fields as well.

Finds history objects by timestamp, and optionally filter on other fields as well.

Parameters

$cmp
<p>The comparison operator (&lt;, >, &lt;=, >=, or =) to check the timestamps with.</p>
$ts
The timestamp to compare against.
$filters
<p>An array of additional (ANDed) criteria. Each array value should be an array with 3 entries: - field: the history field being compared (i.e. 'action'). - op: the operator to compare this field with. - value: the value to check for (i.e. 'add').</p>
$parent
<p>The parent history to start searching at. If non-empty, will be searched for with a LIKE '$parent:%' clause.</p>

Returns

array

An array of history object ids, or an empty array if none matched the criteria.

Throws

Horde_History_Exception
abstract public array
# _getByTimestamp( string $cmp, integer $ts, array $filters = array(), string $parent = null )

Finds history objects by timestamp, and optionally filter on other fields as well.

Finds history objects by timestamp, and optionally filter on other fields as well.

Parameters

$cmp
<p>The comparison operator (&lt;, >, &lt;=, >=, or =) to check the timestamps with.</p>
$ts
The timestamp to compare against.
$filters
<p>An array of additional (ANDed) criteria. Each array value should be an array with 3 entries: - field: the history field being compared (i.e. 'action'). - op: the operator to compare this field with. - value: the value to check for (i.e. 'add').</p>
$parent
<p>The parent history to start searching at. If non-empty, will be searched for with a LIKE '$parent:%' clause.</p>

Returns

array

An array of history object ids, or an empty array if none matched the criteria.

Throws

Horde_History_Exception
public integer
# getActionTimestamp( string $guid, string $action )

Gets the timestamp of the most recent change to $guid.

Gets the timestamp of the most recent change to $guid.

Parameters

$guid
The name of the history entry to retrieve.
$action
An action: 'add', 'modify', 'delete', etc.

Returns

integer
The timestamp, or 0 if no matching entry is found.

Throws

Horde_History_Exception
If the input parameters are not of type string.
public
# removeByParent( string $parent )

Remove one or more history entries by parent.

Remove one or more history entries by parent.

Parameters

$parent
The parent name to remove.

Throws

Horde_History_Exception
abstract public
# removeByNames( array $names )

Removes one or more history entries by name.

Removes one or more history entries by name.

Parameters

$names
The history entries to remove.

Throws

Horde_History_Exception
API documentation generated by ApiGen