PHP 클래스 Horde_SyncMl_Backend_Horde, horde

Copyright 2005-2016 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.
저자: Karsten Fourmont ([email protected])
상속: extends Horde_SyncMl_Backend
파일 보기 프로젝트 열기: horde/horde

보호된 프로퍼티들

프로퍼티 타입 설명
$_db Horde_Db_Adapter_Base A database instance.
$_sessionId string The session ID used in the Horde session.

공개 메소드들

메소드 설명
__construct ( array $params ) Constructor.
addEntry ( string $databaseURI, string $content, string $contentType, string $cuid = null ) : array Adds an entry into the server database.
close ( )
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.
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 ) : boolean Returns entries that have been modified in the server database.
getUserAnchors ( string $user ) : array Returns all previously written sync anchors for a user.
logMessage ( mixed $message, string $priority = 'INFO' ) Logs a message in the backend.
readSyncAnchors ( string $databaseURI ) : mixed Reads the previously written sync anchors from the database.
removeAnchor ( string $user, string $device = null, string $database = null ) : array Deletes previously written sync anchors for a user.
removeMaps ( string $user, string $device = null, string $database = null ) : array Deletes previously written sync maps for a user.
replaceEntry ( string $databaseURI, string $content, string $contentType, string $cuid ) : string Replaces an entry in the server database.
retrieveEntry ( string $databaseURI, string $suid, string $contentType, array $fields ) : mixed Retrieves an entry from the backend.
sessionStart ( string $syncDeviceID, $sessionId, integer $backendMode = Horde_SyncMl_Backend::MODE_SERVER ) Starts a PHP session.
setUser ( string $user ) Sets the user used for this session.
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.

보호된 메소드들

메소드 설명
_checkAuthentication ( string $username, string $password ) : boolean | string Authenticates the user at the backend.
_fastsync ( $databaseURI, $from_ts, $to_ts )
_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.
_setAuthenticated ( string $username, string $credData ) : string Sets a user as being authenticated at the backend.
_slowsync ( $databaseURI, $from_ts, $to_ts )

메소드 상세

__construct() 공개 메소드

Initializes the logger.
public __construct ( array $params )
$params array Any parameters the backend might need.

_checkAuthentication() 보호된 메소드

Authenticates the user at the backend.
protected _checkAuthentication ( string $username, string $password ) : boolean | string
$username string A user name.
$password string A password.
리턴 boolean | string The user name if authentication succeeded, false otherwise.

_fastsync() 보호된 메소드

protected _fastsync ( $databaseURI, $from_ts, $to_ts )

_getChangeTS() 보호된 메소드

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.
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.
리턴 mixed The previously stored timestamp or false if no entry is found.

_getCuid() 보호된 메소드

Retrieves the Client ID for a given Server ID from the map.
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.
리턴 mixed The client ID string or false if no entry is found.

_getSuid() 보호된 메소드

Retrieves the Server ID for a given Client ID from the map.
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.
리턴 mixed The server ID string or false if no entry is found.

_setAuthenticated() 보호된 메소드

Sets a user as being authenticated at the backend.
protected _setAuthenticated ( string $username, string $credData ) : string
$username string A user name.
$credData string Authentication data provided by in the .
리턴 string The user name.

_slowsync() 보호된 메소드

protected _slowsync ( $databaseURI, $from_ts, $to_ts )

addEntry() 공개 메소드

Adds an entry into the server database.
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.
리턴 array PEAR_Error or suid (Horde guid) of new entry

close() 공개 메소드

public close ( )

createUidMap() 공개 메소드

If an entry already exists, it is overwritten.
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".

deleteEntry() 공개 메소드

Deletes an entry from the server database.
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.
리턴 boolean True on success or false on failed (item not found).

eraseMap() 공개 메소드

This is used during SlowSync so that we really sync everything properly and no old mapping entries remain.
public eraseMap ( string $databaseURI )
$databaseURI string URI of database to sync. Like calendar, tasks, contacts or notes. May include optional parameters: tasks?options=ignorecompleted.

getServerChanges() 공개 메소드

Returns entries that have been modified in the server database.
public getServerChanges ( string $databaseURI, integer $from_ts, integer $to_ts, &$adds, &$mods, &$dels ) : boolean
$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.
리턴 boolean true

getUserAnchors() 공개 메소드

Returns all previously written sync anchors for a user.
public getUserAnchors ( string $user ) : array
$user string A user name.
리턴 array A hash tree with all devices, databases and sync anchors from the specified user.

logMessage() 공개 메소드

Logs a message in the backend.
public logMessage ( mixed $message, string $priority = 'INFO' )
$message mixed Either a string or a PEAR_Error object.
$priority string The priority of the message. One of: - EMERG - ALERT - CRIT - ERR - WARN - NOTICE - INFO - DEBUG

readSyncAnchors() 공개 메소드

Reads the previously written sync anchors from the database.
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.
리턴 mixed Two-element array with client anchor and server anchor as stored in previous writeSyncAnchor() calls. False if no data found.

removeAnchor() 공개 메소드

If no device or database are specified, anchors for all devices and/or databases will be deleted.
public removeAnchor ( string $user, string $device = null, string $database = null ) : array
$user string A user name.
$device string The ID of the client device.
$database string Normalized URI of database to delete. Like calendar, tasks, contacts or notes.
리턴 array

removeMaps() 공개 메소드

If no device or database are specified, maps for all devices and/or databases will be deleted.
public removeMaps ( string $user, string $device = null, string $database = null ) : array
$user string A user name.
$device string The ID of the client device.
$database string Normalized URI of database to delete. Like calendar, tasks, contacts or notes.
리턴 array

replaceEntry() 공개 메소드

Replaces an entry in the server database.
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.
리턴 string PEAR_Error or server ID (Horde GUID) of modified entry.

retrieveEntry() 공개 메소드

Retrieves an entry from the backend.
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.
리턴 mixed A string with the data entry or a PEAR_Error object.

sessionStart() 공개 메소드

Starts a PHP session.
public sessionStart ( string $syncDeviceID, $sessionId, integer $backendMode = Horde_SyncMl_Backend::MODE_SERVER )
$syncDeviceID string The device ID.
$backendMode integer The backend mode, one of the Horde_SyncMl_Backend::MODE_* constants.

setUser() 공개 메소드

Sets the user used for this session.
public setUser ( string $user )
$user string A user name.

testSetup() 공개 메소드

Ensures there's a user with the given credentials and an empty data store.
public testSetup ( string $user, string $pwd )
$user string This user accout has to be created in the backend.
$pwd string The password for user $user.

testStart() 공개 메소드

Prepares the test start.
public testStart ( string $user )
$user string This user accout has to be created in the backend.

testTearDown() 공개 메소드

Should remove the testuser created during testSetup and all its data.
public testTearDown ( )

writeSyncAnchors() 공개 메소드

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

프로퍼티 상세

$_db 보호되어 있는 프로퍼티

A database instance.
protected Horde_Db_Adapter_Base $_db
리턴 Horde_Db_Adapter_Base

$_sessionId 보호되어 있는 프로퍼티

The session ID used in the Horde session.
protected string $_sessionId
리턴 string