Class Horde_History

Description

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

$Horde: framework/History/History.php,v 1.28.2.25 2010-11-08 16:17:28 jan Exp $

Copyright 2003-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /History/History.php (line 17)


	
			
Variable Summary
Method Summary
 Horde_History Horde_History ()
 integer getActionTimestamp (string $guid, string $action)
 array getByTimestamp (string $cmp, integer $ts, [array $filters = array()], [string $parent = null])
 void &getHistory (string $guid, [boolean $autocreate = null])
 boolean|PEAR_Error log (string $guid, [array $attributes = array()], [boolean $replaceAction = false])
 void removeByNames (array $names)
Variables
DB $_db (line 24)

Pointer to a DB instance to manage the history.

DB $_write_db (line 32)

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.

Methods
Constructor Horde_History (line 58)

Constructor.

Horde_History Horde_History ()
getActionTimestamp (line 314)

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

  • return: The timestamp, or 0 if no matching entry is found.
integer getActionTimestamp (string $guid, string $action)
  • string $guid: The name of the history entry to retrieve.
  • string $action: An action: 'add', 'modify', 'delete', etc.
getByTimestamp (line 277)

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

  • return: An array of history object ids, or an empty array if none matched the criteria.
array getByTimestamp (string $cmp, integer $ts, [array $filters = array()], [string $parent = null])
  • string $cmp: The comparison operator (<, >, <=, >=, or =) to check the timestamps with.
  • integer $ts: The timestamp to compare against.
  • array $filters: An array of additional (ANDed) criteria. Each array value should be an array with 3 entries:
                             'op'    - the operator to compare this field
                                       with.
                             'field' - the history field being compared
                                       (i.e. 'action').
                             'value' - the value to check for (i.e. 'add').
  • string $parent: The parent history to start searching at. If non-empty, will be searched for with a LIKE '$parent:%' clause.
getHistory (line 236)

Returns a HistoryObject corresponding to the named history entry, with the data retrieved appropriately. $autocreate has no affect.

void &getHistory (string $guid, [boolean $autocreate = null])
  • string $guid: The name of the history entry to retrieve.
  • boolean $autocreate: Deprecated.
log (line 137)

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).

  • return: True on success, PEAR_Error on failure.
boolean|PEAR_Error log (string $guid, [array $attributes = array()], [boolean $replaceAction = false])
  • string $guid: The unique identifier of the entry to add to.
  • array $attributes: The hash of name => value entries that describe this event.
  • boolean $replaceAction: If $attributes['action'] is already present in the item's history log, update that entry instead of creating a new one.
removeByNames (line 341)

Remove one or more history entries by name.

void removeByNames (array $names)
  • array $names: The history entries to remove.
singleton (line 44)

Attempts to return a reference to a concrete History instance.

It will only create a new instance if no History instance currently exists.

This method must be invoked as: $var = &History::singleton()

  • return: The concrete History reference, or false on an error.
Horde_History &singleton ()

Documentation generated on Sun, 30 Jan 2011 05:17:59 +0000 by phpDocumentor 1.4.3