Overview

Packages

  • None
  • SyncMl

Classes

  • Horde_SyncMl
  • Horde_SyncMl_Backend
  • Horde_SyncMl_Backend_Horde
  • Horde_SyncMl_Command
  • Horde_SyncMl_Command_Alert
  • Horde_SyncMl_Command_Final
  • Horde_SyncMl_Command_Get
  • Horde_SyncMl_Command_Map
  • Horde_SyncMl_Command_Put
  • Horde_SyncMl_Command_Replace
  • Horde_SyncMl_Command_Results
  • Horde_SyncMl_Command_Status
  • Horde_SyncMl_Command_Sync
  • Horde_SyncMl_Command_SyncHdr
  • Horde_SyncMl_ContentHandler
  • Horde_SyncMl_DataStore
  • Horde_SyncMl_Device
  • Horde_SyncMl_Device_Nokia
  • Horde_SyncMl_Device_P800
  • Horde_SyncMl_Device_sync4j
  • Horde_SyncMl_Device_Sync4JMozilla
  • Horde_SyncMl_Device_Synthesis
  • Horde_SyncMl_DeviceInfo
  • Horde_SyncMl_Property
  • Horde_SyncMl_PropertyParameter
  • Horde_SyncMl_State
  • Horde_SyncMl_Sync
  • Horde_SyncMl_SyncElement
  • Horde_SyncMl_Translation
  • Horde_SyncMl_XmlOutput
  • Overview
  • Package
  • Class
  • Tree

Class Horde_SyncMl_Backend_Horde

SyncML Backend for the Horde Application framework.

Copyright 2005-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.

Horde_SyncMl_Backend
Extended by Horde_SyncMl_Backend_Horde
Package: SyncMl
Author: Karsten Fourmont karsten@horde.org
Located at Horde/SyncMl/Backend/Horde.php
Methods summary
public
# __construct( array $params )

Constructor.

Constructor.

Initializes the logger.

Parameters

$params
Any parameters the backend might need.

Overrides

Horde_SyncMl_Backend::__construct()
public
# setUser( string $user )

Sets the user used for this session.

Sets the user used for this session.

Parameters

$user
A user name.

Overrides

Horde_SyncMl_Backend::setUser()
public
# sessionStart( string $syncDeviceID, string $sessionId, integer $backendMode = Horde_SyncMl_Backend::MODE_SERVER )

Starts a PHP session.

Starts a PHP session.

Parameters

$syncDeviceID
The device ID.
$sessionId
$session_id The session ID to use.
$backendMode
<p>The backend mode, one of the Horde_SyncMl_Backend::MODE_* constants.</p>

Overrides

Horde_SyncMl_Backend::sessionStart()
public
# close( )

Cleanup public function called after all message processing is finished.

Cleanup public function called after all message processing is finished.

Allows for things like closing databases or flushing logs. When running in test mode, tearDown() must be called rather than close.

Overrides

Horde_SyncMl_Backend::close()
public boolean
# getServerChanges( string $databaseURI, integer $from_ts, integer $to_ts, array & $adds, array & $mods, array & $dels )

Returns entries that have been modified in the server database.

Returns entries that have been modified in the server database.

Parameters

$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$from_ts
Start timestamp.
$to_ts
<p>Exclusive end timestamp. Not yet implemented.</p>
$adds
$adds Output array: hash of adds suid => 0
$mods
<p>$mods Output array: hash of modifications suid => cuid</p>
$dels
$dels Output array: hash of deletions suid => cuid

Returns

boolean
true

Overrides

Horde_SyncMl_Backend::getServerChanges()
public mixed
# retrieveEntry( string $databaseURI, string $suid, string $contentType, array $fields )

Retrieves an entry from the backend.

Retrieves an entry from the backend.

Parameters

$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$suid
<p>Server unique id of the entry: for horde this is the guid.</p>
$contentType
<p>Content-Type: the MIME type in which the public function should return the data.</p>
$fields
<p>Hash of field names and Horde_SyncMl_Property properties with the requested fields.</p>

Returns

mixed
A string with the data entry or a PEAR_Error object.

Overrides

Horde_SyncMl_Backend::retrieveEntry()
public array
# addEntry( string $databaseURI, string $content, string $contentType, string $cuid = null )

Adds an entry into the server database.

Adds an entry into the server database.

Parameters

$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$content
The actual data.
$contentType
MIME type of the content.
$cuid
Client ID of this entry.

Returns

array
PEAR_Error or suid (Horde guid) of new entry

Overrides

Horde_SyncMl_Backend::addEntry()
public string
# replaceEntry( string $databaseURI, string $content, string $contentType, string $cuid )

Replaces an entry in the server database.

Replaces an entry in the server database.

Parameters

$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$content
The actual data.
$contentType
MIME type of the content.
$cuid
Client ID of this entry.

Returns

string
PEAR_Error or server ID (Horde GUID) of modified entry.

Overrides

Horde_SyncMl_Backend::replaceEntry()
public boolean
# deleteEntry( string $databaseURI, string $cuid )

Deletes an entry from the server database.

Deletes an entry from the server database.

Parameters

$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$cuid
Client ID of the entry.

Returns

boolean
True on success or false on failed (item not found).

Overrides

Horde_SyncMl_Backend::deleteEntry()
public
# writeSyncAnchors( string $databaseURI, string $clientAnchorNext, string $serverAnchorNext )

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

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.

Parameters

$databaseURI
<p>URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$clientAnchorNext
<p>The client anchor as sent by the client.</p>
$serverAnchorNext
<p>The anchor as used internally by the server.</p>

Overrides

Horde_SyncMl_Backend::writeSyncAnchors()
public mixed
# readSyncAnchors( string $databaseURI )

Reads the previously written sync anchors from the database.

Reads the previously written sync anchors from the database.

Parameters

$databaseURI
<p>URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>

Returns

mixed

Two-element array with client anchor and server anchor as stored in previous writeSyncAnchor() calls. False if no data found.

Overrides

Horde_SyncMl_Backend::readSyncAnchors()
public array
# getUserAnchors( string $user )

Returns all previously written sync anchors for a user.

Returns all previously written sync anchors for a user.

Parameters

$user
A user name.

Returns

array

A hash tree with all devices, databases and sync anchors from the specified user.

public array
# removeAnchor( string $user, string $device = null, string $database = null )

Deletes previously written sync anchors for a user.

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.

Parameters

$user
A user name.
$device
The ID of the client device.
$database
<p>Normalized URI of database to delete. Like calendar, tasks, contacts or notes.</p>

Returns

array
public array
# removeMaps( string $user, string $device = null, string $database = null )

Deletes previously written sync maps for a user.

Deletes previously written sync maps for a user.

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

Parameters

$user
A user name.
$device
The ID of the client device.
$database
<p>Normalized URI of database to delete. Like calendar, tasks, contacts or notes.</p>

Returns

array
public
# createUidMap( string $databaseURI, string $cuid, string $suid, integer $timestamp = 0 )

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

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

If an entry already exists, it is overwritten.

Parameters

$databaseURI
<p>URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$cuid
Client ID of the entry.
$suid
Server ID of the entry.
$timestamp
<p>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".</p>

Overrides

Horde_SyncMl_Backend::createUidMap()
public
# eraseMap( string $databaseURI )

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

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.

Parameters

$databaseURI
<p>URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>

Overrides

Horde_SyncMl_Backend::eraseMap()
public
# logMessage( mixed $message, string $priority = 'INFO' )

Logs a message in the backend.

Logs a message in the backend.

Parameters

$message
Either a string or a PEAR_Error object.
$priority
<p>The priority of the message. One of: - EMERG - ALERT - CRIT - ERR - WARN - NOTICE - INFO - DEBUG</p>

Overrides

Horde_SyncMl_Backend::logMessage()
public
# testSetup( string $user, string $pwd )

Creates a clean test environment in the backend.

Creates a clean test environment in the backend.

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

Parameters

$user
This user accout has to be created in the backend.
$pwd
The password for user $user.

Throws

Horde_Exception

Overrides

Horde_SyncMl_Backend::testSetup()
public
# testStart( string $user )

Prepares the test start.

Prepares the test start.

Parameters

$user
This user accout has to be created in the backend.

Overrides

Horde_SyncMl_Backend::testStart()
public
# testTearDown( )

Tears down the test environment after the test is run.

Tears down the test environment after the test is run.

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

Overrides

Horde_SyncMl_Backend::testTearDown()
Methods inherited from Horde_SyncMl_Backend
checkAuthentication(), factory(), getCharset(), getCurrentTimeStamp(), getParameter(), getSyncDeviceID(), getUser(), isValidDatabaseURI(), logFile(), normalize(), sessionClose(), setCharset(), setupState()
Constants inherited from Horde_SyncMl_Backend
LOGFILE_CLIENTMESSAGE, LOGFILE_DATA, LOGFILE_DEVINF, LOGFILE_SERVERMESSAGE, MODE_CLIENT, MODE_SERVER, MODE_TEST
Properties inherited from Horde_SyncMl_Backend
$state
API documentation generated by ApiGen