Overview

Packages

  • None
  • SyncMl

Classes

  • Horde_SyncMl_Backend_Sql
  • Overview
  • Package
  • Class
  • Tree

Class Horde_SyncMl_Backend_Sql

Horde_SyncMl_Backend
Extended by Horde_SyncMl_Backend_Sql
Located at Horde/SyncMl/Backend/Sql.php
Methods summary
public
# __construct( array $params )

Constructor.

Constructor.

Parameters

$params
<p>A hash with parameters. In addition to those supported by the Horde_SyncMl_Backend class one more parameter is required for the database connection: 'dsn' => connection DSN.</p>

Overrides

Horde_SyncMl_Backend::__construct()
public boolean
# isValidDatabaseURI( string $databaseURI )

Returns whether a database URI is valid to be synced with this backend.

Returns whether a database URI is valid to be synced with this backend.

Parameters

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

Returns

boolean
True if a valid URI.

Overrides

Horde_SyncMl_Backend::isValidDatabaseURI()
public mixed
# 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

mixed
True on success or a PEAR_Error object.

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

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()
public array
# addEntry_backend( string $user, string $databaseURI, string $content, string $contentType )

Adds an entry into the server database.

Adds an entry into the server database.

Parameters

$user
<p>The username to use. Not strictly necessery to store this, but it helps for the test environment to clean up all entries for a test user.</p>
$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.

Returns

array
PEAR_Error or suid of new entry.
public string
# replaceEntry_backend( string $user, string $databaseURI, string $content, string $contentType, string $suid )

Replaces an entry in the server database.

Replaces an entry in the server database.

Parameters

$user
<p>The username to use. Not strictly necessery to store this but, it helps for the test environment to clean up all entries for a test user.</p>
$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.
$suid
Server ID of this entry.

Returns

string
PEAR_Error or suid of modified entry.
public boolean
# deleteEntry_backend( string $user, string $databaseURI, string $suid )

Deletes an entry from the server database.

Deletes an entry from the server database.

Parameters

$user
<p>The username to use. Not strictly necessery to store this, but it helps for the test environment to clean up all entries for a test user.</p>
$databaseURI
<p>URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.</p>
$suid
Server ID of the entry.

Returns

boolean
True on success or false on failed (item not found).
Methods inherited from Horde_SyncMl_Backend
checkAuthentication(), factory(), getCharset(), getCurrentTimeStamp(), getParameter(), getSyncDeviceID(), getUser(), logFile(), logMessage(), normalize(), sessionClose(), sessionStart(), setCharset(), setUser(), 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