Class XOAD_Events_Storage_File

Description

XOAD Events Storage File Class.

This class is a XOAD_Events_Storage successor.

The class allows you to save events information in a flat file.

Example:

  1. <?php
  2.  
  3. require_once('xoad.php');
  4.  
  5. require_once(XOAD_BASE . '/classes/events/storage/File.class.php');
  6.  
  7. $storage = new XOAD_Events_Storage_File(['container=filename']);
  8.  
  9. $storage->postEvent('event', 'class');
  10.  
  11. ?>

  • version: 0.6.0.0
  • author: Stanimir Angeloff

Located in /classes/events/storage/File.class.php (line 61)

XOAD_Events_Storage
   |
   --XOAD_Events_Storage_File
Variable Summary
 string $container
 string $separator
Method Summary
 XOAD_Events_Storage_File XOAD_Events_Storage_File (string $dsn)
 bool cleanEvents ()
 array filterMultipleEvents (array $eventsData)
 string getFileName ()
 object A &getStorage (string $dsn)
 bool postMultipleEvents (array $eventsData)
 int sortEvents (array $a, array $b)
Variables
string $container = 'EVENTS' (line 71)

Holds the file name where events information is saved.

  • access: protected
string $separator = "\t***\t" (line 81)

Holds the separator used in the container.

  • access: protected
Methods
Constructor XOAD_Events_Storage_File (line 92)

Creates a new instance of the XOAD_Events_Storage_File class.

  • access: public
XOAD_Events_Storage_File XOAD_Events_Storage_File (string $dsn)
  • string $dsn: The data source name and parameters to use when creating the instance.
cleanEvents (line 252)

Deletes old events from the container.

This method is called before calling filterEvents or filterMultipleEvents to delete all expired events from the container.

  • return: true on success, false otherwise.
  • access: public
bool cleanEvents ()

Redefinition of:
XOAD_Events_Storage::cleanEvents()
This method should be called from each successor to retrieve the start time of the old events in the storage.
filterMultipleEvents (line 320)

Filters the events in the container using multiple criterias.

Valid keys for each event are:

  • event - the event name (case-sensitive);
  • className - the class that is the source of the event;
  • filter - the event filter data (case-insensitive); using this argument you can filter events with the same name but with different filter data;
  • time - the event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

  • return: Sequental array that contains all events that match the supplied criterias, ordered by time (ascending).
  • access: public
array filterMultipleEvents (array $eventsData)
  • array $eventsData: Array containing associative arrays with information for each event.

Redefinition of:
XOAD_Events_Storage::filterMultipleEvents()
This method should be called from each successor to add common data to the event.
getFileName (line 133)

Gets the absolute path to the container.

  • access: private
string getFileName ()
getStorage (line 113)

Retrieves a static instance of the XOAD_Events_Storage_File class.

This method overrides XOAD_Events_Storage::getStorage.

object A &getStorage (string $dsn)
  • string $dsn: The data source name and parameters to use when retrieving the instance.

Redefinition of:
XOAD_Events_Storage::getStorage()
Retrieves an instanse to the configurated XOAD Events storage provider.
postMultipleEvents (line 177)

Posts multiple events to the container.

Valid keys for each event are:

  • event - the event name (case-sensitive);
  • className - the class that is the source of the event;
  • sender - the sender object of the event;
  • data - the data associated with the event;
  • filter - the event filter data (case-insensitive); using this key you can post events with the same name but with different filter data; the client will respond to them individually;
  • time - the event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT);
  • lifetime - the event lifetime (in seconds);

  • return: true on success, false otherwise.
  • access: public
bool postMultipleEvents (array $eventsData)
  • array $eventsData: Array containing associative arrays with information for each event.

Redefinition of:
XOAD_Events_Storage::postMultipleEvents()
This method should be called from each successor to add common data to the event.
sortEvents (line 393)

Callback to sort events by time.

  • return: Less than, equal to, or greater than zero if the first event's time is considered to be respectively less than, equal to, or greater than the second event's time.
  • access: public
int sortEvents (array $a, array $b)
  • array $a: Data associated with the first event.
  • array $b: Data associated with the second event.

Inherited Methods

Inherited From XOAD_Events_Storage

 XOAD_Events_Storage::XOAD_Events_Storage()
 XOAD_Events_Storage::cleanEvents()
 XOAD_Events_Storage::filterEvents()
 XOAD_Events_Storage::filterMultipleEvents()
 XOAD_Events_Storage::getStorage()
 XOAD_Events_Storage::postEvent()
 XOAD_Events_Storage::postMultipleEvents()

Documentation generated on Sat, 12 Nov 2005 20:24:08 +0200 by phpDocumentor 1.3.0RC3