Property | Type | Description | |
---|---|---|---|
$_db | MDB2 | A PEAR MDB2 instance. |
Method | Description | |
---|---|---|
__construct ( array $params ) | Constructor. | |
addEntry ( string $databaseURI, string $content, string $contentType, string $cuid = null ) : array | Adds an entry into the server database. | |
addEntry_backend ( string $user, string $databaseURI, string $content, string $contentType ) : array | Adds an entry into the server database. | |
close ( ) | Cleanup public function called after all message processing is finished. | |
createUidMap ( string $databaseURI, string $cuid, string $suid, integer $timestamp ) | Creates a map entry to map between server and client IDs. | |
deleteEntry ( string $databaseURI, string $cuid ) : boolean | Deletes an entry from the server database. | |
deleteEntry_backend ( string $user, string $databaseURI, string $suid ) : boolean | Deletes an entry from the server database. | |
eraseMap ( string $databaseURI ) | Erases all mapping entries for one combination of user, device ID. | |
getServerChanges ( string $databaseURI, integer $from_ts, integer $to_ts, &$adds, &$mods, &$dels ) : mixed | Returns entries that have been modified in the server database. | |
isValidDatabaseURI ( string $databaseURI ) : boolean | Returns whether a database URI is valid to be synced with this backend. | |
readSyncAnchors ( string $databaseURI ) : mixed | Reads the previously written sync anchors from the database. | |
replaceEntry ( string $databaseURI, string $content, string $contentType, string $cuid ) : string | Replaces an entry in the server database. | |
replaceEntry_backend ( string $user, string $databaseURI, string $content, string $contentType, string $suid ) : string | Replaces an entry in the server database. | |
retrieveEntry ( string $databaseURI, string $suid, string $contentType, array $fields ) : mixed | Retrieves an entry from the backend. | |
testSetup ( string $user, string $pwd ) | Creates a clean test environment in the backend. | |
testStart ( string $user ) | Prepares the test start. | |
testTearDown ( ) | Tears down the test environment after the test is run. | |
writeSyncAnchors ( string $databaseURI, string $clientAnchorNext, string $serverAnchorNext ) | Stores Sync anchors after a successful synchronization to allow two-way synchronization next time. |
Method | Description | |
---|---|---|
_checkAuthentication ( string $username, string $password ) : boolean | string | Authenticates the user at the backend. | |
_checkForError ( mixed $o ) : mixed | Checks if the parameter is a PEAR_Error object and if so logs the error. | |
_cleanUser ( $user ) | ||
_getChangeTS ( string $databaseURI, string $suid ) : mixed | Returns a timestamp stored in the map for a given Server ID. | |
_getCuid ( string $databaseURI, string $suid ) : mixed | Retrieves the Client ID for a given Server ID from the map. | |
_getSuid ( string $databaseURI, string $cuid ) : mixed | Retrieves the Server ID for a given Client ID from the map. | |
_removeFromSuidList ( string $databaseURI, array $suid ) | Removes a suid from the suidlist. | |
_setAuthenticated ( string $username, string $credData ) : string | Sets a user as being authenticated at the backend. | |
_trackDeletes ( string $databaseURI, array $currentSuids ) : array | Returns a list of item IDs that have been deleted since the last sync run and stores a complete list of IDs for next sync run. |
public __construct ( array $params ) | ||
$params | array | 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. |
protected _checkForError ( mixed $o ) : mixed | ||
$o | mixed | An object or value to check. |
return | mixed | The error object if an error has been passed or false if no error has been passed. |
protected _getChangeTS ( string $databaseURI, string $suid ) : mixed | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$suid | string | The server ID. |
return | mixed | The previously stored timestamp or false if no entry is found. |
protected _getCuid ( string $databaseURI, string $suid ) : mixed | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$suid | string | The server ID. |
return | mixed | The client ID string or false if no entry is found. |
protected _getSuid ( string $databaseURI, string $cuid ) : mixed | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$cuid | string | The client ID. |
return | mixed | The server ID string or false if no entry is found. |
protected _removeFromSuidList ( string $databaseURI, array $suid ) | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$suid | array | The suid to remove from the list. |
protected _trackDeletes ( string $databaseURI, array $currentSuids ) : array | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$currentSuids | array | Array of all SUIDs (primary keys) currently in the server datastore. |
return | array | Array of all entries that have been deleted since the last call. |
public addEntry ( string $databaseURI, string $content, string $contentType, string $cuid = null ) : array | ||
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$content | string | The actual data. |
$contentType | string | MIME type of the content. |
$cuid | string | Client ID of this entry. |
return | array | PEAR_Error or suid (Horde guid) of new entry |
public addEntry_backend ( string $user, string $databaseURI, string $content, string $contentType ) : array | ||
$user | string | 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. |
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$content | string | The actual data. |
$contentType | string | MIME type of the content. |
return | array | PEAR_Error or suid of new entry. |
public close ( ) |
public createUidMap ( string $databaseURI, string $cuid, string $suid, integer $timestamp ) | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$cuid | string | Client ID of the entry. |
$suid | string | Server ID of the entry. |
$timestamp | integer | 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". |
public deleteEntry ( string $databaseURI, string $cuid ) : boolean | ||
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$cuid | string | Client ID of the entry. |
return | boolean | True on success or false on failed (item not found). |
public deleteEntry_backend ( string $user, string $databaseURI, string $suid ) : boolean | ||
$user | string | 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. |
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$suid | string | Server ID of the entry. |
return | boolean | True on success or false on failed (item not found). |
public getServerChanges ( string $databaseURI, integer $from_ts, integer $to_ts, &$adds, &$mods, &$dels ) : mixed | ||
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$from_ts | integer | Start timestamp. |
$to_ts | integer | Exclusive end timestamp. Not yet implemented. |
return | mixed | True on success or a PEAR_Error object. |
public isValidDatabaseURI ( string $databaseURI ) : boolean | ||
$databaseURI | string | URI of a database. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
return | boolean | True if a valid URI. |
public readSyncAnchors ( string $databaseURI ) : mixed | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
return | mixed | Two-element array with client anchor and server anchor as stored in previous writeSyncAnchor() calls. False if no data found. |
public replaceEntry ( string $databaseURI, string $content, string $contentType, string $cuid ) : string | ||
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$content | string | The actual data. |
$contentType | string | MIME type of the content. |
$cuid | string | Client ID of this entry. |
return | string | PEAR_Error or server ID (Horde GUID) of modified entry. |
public replaceEntry_backend ( string $user, string $databaseURI, string $content, string $contentType, string $suid ) : string | ||
$user | string | 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. |
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$content | string | The actual data. |
$contentType | string | MIME type of the content. |
$suid | string | Server ID of this entry. |
return | string | PEAR_Error or suid of modified entry. |
public retrieveEntry ( string $databaseURI, string $suid, string $contentType, array $fields ) : mixed | ||
$databaseURI | string | URI of Database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$suid | string | Server unique id of the entry: for horde this is the guid. |
$contentType | string | Content-Type: the MIME type in which the public function should return the data. |
$fields | array | Hash of field names and Horde_SyncMl_Property properties with the requested fields. |
return | mixed | A string with the data entry or a PEAR_Error object. |
public testTearDown ( ) |
public writeSyncAnchors ( string $databaseURI, string $clientAnchorNext, string $serverAnchorNext ) | ||
$databaseURI | string | URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted. |
$clientAnchorNext | string | The client anchor as sent by the client. |
$serverAnchorNext | string | The anchor as used internally by the server. |