Constructor.
Initializes the logger.
SyncML_Backend_Horde
SyncML_Backend_Horde
(array $params)
-
array
$params: Any parameters the backend might need.
Adds an entry into the server database.
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.
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.
Deletes an entry from the server database.
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.
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.
Returns entries that have been modified in the server database.
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.
Returns all previously written sync anchors for a user.
array
getUserAnchors
(string $user)
-
string
$user: A user name.
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.
Reads the previously written sync anchors from the database.
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.
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.
Replaces an entry in the server database.
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.
Retrieves an entry from the backend.
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.
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.
Sets a user as being authenticated at the backend.
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.
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.
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.
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.
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.
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.
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.
Authenticates the user at the backend.
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.
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.
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.
Retrieves the Client ID for a given Server ID from the map.
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.
Retrieves the Server ID for a given Client ID from the map.
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()