Class SyncML_Backend_Horde

Description

Located in /SyncML/SyncML/Backend/Horde.php (line 19)

SyncML_Backend
   |
   --SyncML_Backend_Horde
Variable Summary
 DB $_db
Method Summary
 SyncML_Backend_Horde SyncML_Backend_Horde (array $params)
 array addEntry (string $databaseURI, string $content, string $contentType, [string $cuid = null])
 void createUidMap (string $databaseURI, string $cuid, string $suid, [integer $timestamp = 0])
 boolean deleteEntry (string $databaseURI, string $cuid)
 void eraseMap (string $databaseURI)
 mixed getServerChanges (string $databaseURI, integer $from_ts, integer $to_ts, array &$adds, array &$mods, array &$dels)
 array getUserAnchors (string $user)
 void logMessage (mixed $message, string $file, integer $line, [integer $priority = PEAR_LOG_INFO])
 mixed readSyncAnchors (string $databaseURI)
 array removeAnchor (string $user, [string $device = null], [string $database = null])
 string replaceEntry (string $databaseURI, string $content, string $contentType, string $cuid)
 mixed retrieveEntry (string $databaseURI, string $suid, string $contentType, array $fields)
 void sessionStart (string $syncDeviceID,  $sessionId, [integer $backendMode = SYNCML_BACKENDMODE_SERVER], string $session_id)
 string setAuthenticated (string $username, string $credData)
 void setCharset (string $charset)
 void setUser (string $user)
 void testSetup (string $user, string $pwd)
 void testStart (string $user)
 void testTearDown ()
 void writeSyncAnchors (string $databaseURI, string $clientAnchorNext, string $serverAnchorNext)
 boolean|string _checkAuthentication (string $username, string $password)
 mixed _getChangeTS (string $databaseURI, string $suid)
 mixed _getCuid (string $databaseURI, string $suid)
 mixed _getSuid (string $databaseURI, string $cuid)
Variables
Methods
Constructor SyncML_Backend_Horde (line 35)

Constructor.

Initializes the logger.

SyncML_Backend_Horde SyncML_Backend_Horde (array $params)
  • array $params: Any parameters the backend might need.
addEntry (line 372)

Adds an entry into the server database.

  • return: PEAR_Error or suid (Horde guid) of new entry
array addEntry (string $databaseURI, string $content, string $contentType, [string $cuid = null])
  • string $databaseURI: URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $content: The actual data.
  • string $contentType: MIME type of the content.
  • string $cuid: Client ID of this entry.

Redefinition of:
SyncML_Backend::addEntry()
Adds an entry into the server database.
createUidMap (line 718)

Creates a map entry to map between server and client IDs.

If an entry already exists, it is overwritten.

void createUidMap (string $databaseURI, string $cuid, string $suid, [integer $timestamp = 0])
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $cuid: Client ID of the entry.
  • string $suid: Server ID of the entry.
  • integer $timestamp: Optional timestamp. This can be used to 'tag' changes made in the backend during the sync process. This allows to identify these, and ensure that these changes are not replicated back to the client (and thus duplicated). See key concept "Changes and timestamps".

Redefinition of:
SyncML_Backend::createUidMap()
Creates a map entry to map between server and client IDs.
deleteEntry (line 483)

Deletes an entry from the server database.

  • return: True on success or false on failed (item not found).
boolean deleteEntry (string $databaseURI, string $cuid)
  • string $databaseURI: URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $cuid: Client ID of the entry.

Redefinition of:
SyncML_Backend::deleteEntry()
Deletes an entry from the server database.
eraseMap (line 863)

Erases all mapping entries for one combination of user, device ID.

This is used during SlowSync so that we really sync everything properly and no old mapping entries remain.

void eraseMap (string $databaseURI)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.

Redefinition of:
SyncML_Backend::eraseMap()
Erases all mapping entries for one combination of user, device ID.
getServerChanges (line 130)

Returns entries that have been modified in the server database.

  • return: True on success or a PEAR_Error object.
mixed getServerChanges (string $databaseURI, integer $from_ts, integer $to_ts, array &$adds, array &$mods, array &$dels)
  • string $databaseURI: URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • integer $from_ts: Start timestamp.
  • integer $to_ts: Exclusive end timestamp. Not yet implemented.
  • array &$adds: Output array: hash of adds suid => 0
  • array &$mods: Output array: hash of modifications suid => cuid
  • array &$dels: Output array: hash of deletions suid => cuid

Redefinition of:
SyncML_Backend::getServerChanges()
Returns entries that have been modified in the server database.
getUserAnchors (line 640)

Returns all previously written sync anchors for a user.

  • return: A hash tree with all devices, databases and sync anchors from the specified user.
array getUserAnchors (string $user)
  • string $user: A user name.
logMessage (line 901)

Logs a message in the backend.

void logMessage (mixed $message, string $file, integer $line, [integer $priority = PEAR_LOG_INFO])
  • mixed $message: Either a string or a PEAR_Error object.
  • string $file: What file was the log function called from (e.g. __FILE__)?
  • integer $line: What line was the log function called from (e.g. __LINE__)?
  • integer $priority: The priority of the message. One of:
    • PEAR_LOG_EMERG
    • PEAR_LOG_ALERT
    • PEAR_LOG_CRIT
    • PEAR_LOG_ERR
    • PEAR_LOG_WARNING
    • PEAR_LOG_NOTICE
    • PEAR_LOG_INFO
    • PEAR_LOG_DEBUG

Redefinition of:
SyncML_Backend::logMessage()
Logs a message in the backend.
readSyncAnchors (line 610)

Reads the previously written sync anchors from the database.

  • return: Two-element array with client anchor and server anchor as stored in previous writeSyncAnchor() calls. False if no data found.
mixed readSyncAnchors (string $databaseURI)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.

Redefinition of:
SyncML_Backend::readSyncAnchors()
Reads the previously written sync anchors from the database.
removeAnchor (line 673)

Deletes previously written sync anchors for a user.

If no device or database are specified, anchors for all devices and/or databases will be deleted.

array removeAnchor (string $user, [string $device = null], [string $database = null])
  • string $user: A user name.
  • string $device: The ID of the client device.
  • string $database: Normalized URI of database to delete. Like calendar, tasks, contacts or notes.
replaceEntry (line 433)

Replaces an entry in the server database.

  • return: PEAR_Error or server ID (Horde GUID) of modified entry.
string replaceEntry (string $databaseURI, string $content, string $contentType, string $cuid)
  • string $databaseURI: URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $content: The actual data.
  • string $contentType: MIME type of the content.
  • string $cuid: Client ID of this entry.

Redefinition of:
SyncML_Backend::replaceEntry()
Replaces an entry in the server database.
retrieveEntry (line 352)

Retrieves an entry from the backend.

  • return: A string with the data entry or a PEAR_Error object.
mixed retrieveEntry (string $databaseURI, string $suid, string $contentType, array $fields)
  • string $databaseURI: URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $suid: Server unique id of the entry: for horde this is the guid.
  • string $contentType: Content-Type: the MIME type in which the function should return the data.
  • array $fields: Hash of field names and SyncML_Property properties with the requested fields.

Redefinition of:
SyncML_Backend::retrieveEntry()
Retrieves an entry from the backend.
sessionStart (line 99)

Starts a PHP session.

void sessionStart (string $syncDeviceID,  $sessionId, [integer $backendMode = SYNCML_BACKENDMODE_SERVER], string $session_id)
  • string $syncDeviceID: The device ID.
  • string $session_id: The session ID to use.
  • integer $backendMode: The backend mode, one of the SYNCML_BACKENDMODE_* constants.
  • $sessionId

Redefinition of:
SyncML_Backend::sessionStart()
Starts a PHP session.
setAuthenticated (line 547)

Sets a user as being authenticated at the backend.

  • return: The user name.
  • abstract:
string setAuthenticated (string $username, string $credData)
  • string $username: A user name.
  • string $credData: Authentication data provided by <Cred><Data> in the <SyncHdr>.

Redefinition of:
SyncML_Backend::setAuthenticated()
Sets a user as being authenticated at the backend.
setCharset (line 66)

Sets the charset.

All data passed to the backend uses this charset and data returned from the backend must use this charset, too.

void setCharset (string $charset)
  • string $charset: A valid charset.

Redefinition of:
SyncML_Backend::setCharset()
Sets the charset.
setUser (line 79)

Sets the user used for this session.

void setUser (string $user)
  • string $user: A user name.

Redefinition of:
SyncML_Backend::setUser()
Sets the user used for this session.
testSetup (line 919)

Creates a clean test environment in the backend.

Ensures there's a user with the given credentials and an empty data store.

void testSetup (string $user, string $pwd)
  • string $user: This user accout has to be created in the backend.
  • string $pwd: The password for user $user.

Redefinition of:
SyncML_Backend::testSetup()
Creates a clean test environment in the backend.
testStart (line 959)

Prepares the test start.

void testStart (string $user)
  • string $user: This user accout has to be created in the backend.

Redefinition of:
SyncML_Backend::testStart()
Prepares the test start.
testTearDown (line 981)

Tears down the test environment after the test is run.

Should remove the testuser created during testSetup and all its data.

void testTearDown ()

Redefinition of:
SyncML_Backend::testTearDown()
Tears down the test environment after the test is run.
writeSyncAnchors (line 571)

Stores Sync anchors after a successful synchronization to allow two-way synchronization next time.

The backend has to store the parameters in its persistence engine where user, syncDeviceID and database are the keys while client and server anchor ar the payload. See readSyncAnchors() for retrieval.

void writeSyncAnchors (string $databaseURI, string $clientAnchorNext, string $serverAnchorNext)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $clientAnchorNext: The client anchor as sent by the client.
  • string $serverAnchorNext: The anchor as used internally by the server.

Redefinition of:
SyncML_Backend::writeSyncAnchors()
Stores Sync anchors after a successful synchronization to allow two-way synchronization next time.
_checkAuthentication (line 528)

Authenticates the user at the backend.

  • return: The user name if authentication succeeded, false otherwise.
boolean|string _checkAuthentication (string $username, string $password)
  • string $username: A user name.
  • string $password: A password.

Redefinition of:
SyncML_Backend::_checkAuthentication()
Authenticates the user at the backend.
_getChangeTS (line 832)

Returns a timestamp stored in the map for a given Server ID.

The timestamp is the timestamp of the last change to this server ID that was done inside a sync session (as a result of a change received by the server). It's important to distinguish changes in the backend a) made by the user during normal operation and b) changes made by SyncML to reflect client updates. When the server is sending its changes it is only allowed to send type a). However the history feature in the backend my not know if a change is of type a) or type b). So the timestamp is used to differentiate between the two.

  • return: The previously stored timestamp or false if no entry is found.
mixed _getChangeTS (string $databaseURI, string $suid)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $suid: The server ID.
_getCuid (line 791)

Retrieves the Client ID for a given Server ID from the map.

  • return: The client ID string or false if no entry is found.
mixed _getCuid (string $databaseURI, string $suid)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $suid: The server ID.
_getSuid (line 760)

Retrieves the Server ID for a given Client ID from the map.

  • return: The server ID string or false if no entry is found.
mixed _getSuid (string $databaseURI, string $cuid)
  • string $databaseURI: URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.
  • string $cuid: The client ID.

Inherited Methods

Inherited From SyncML_Backend

 SyncML_Backend::SyncML_Backend()
 SyncML_Backend::addEntry()
 SyncML_Backend::checkAuthentication()
 SyncML_Backend::close()
 SyncML_Backend::createUidMap()
 SyncML_Backend::deleteEntry()
 SyncML_Backend::eraseMap()
 SyncML_Backend::factory()
 SyncML_Backend::getCharset()
 SyncML_Backend::getCurrentTimeStamp()
 SyncML_Backend::getParameter()
 SyncML_Backend::getServerChanges()
 SyncML_Backend::getSyncDeviceID()
 SyncML_Backend::getUser()
 SyncML_Backend::isValidDatabaseURI()
 SyncML_Backend::logFile()
 SyncML_Backend::logMessage()
 SyncML_Backend::readSyncAnchors()
 SyncML_Backend::replaceEntry()
 SyncML_Backend::retrieveEntry()
 SyncML_Backend::sessionClose()
 SyncML_Backend::sessionStart()
 SyncML_Backend::setAuthenticated()
 SyncML_Backend::setCharset()
 SyncML_Backend::setupState()
 SyncML_Backend::setUser()
 SyncML_Backend::testSetup()
 SyncML_Backend::testStart()
 SyncML_Backend::testTearDown()
 SyncML_Backend::writeSyncAnchors()
 SyncML_Backend::_checkAuthentication()
 SyncML_Backend::_normalize()

Documentation generated on Sun, 30 Jan 2011 05:18:01 +0000 by phpDocumentor 1.4.3