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.
Methods summary
public
|
|
public
null
|
#
setLogger( Horde_Log_Logger $logger )
Set the log handler.
Parameters
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
|
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
Throws
|
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
|
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 (<, >, <=, >=, 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
|
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 (<, >, <=, >=, 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
|
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
|
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
|
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
|