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.
	 
	
	Methods summary
	
		
			 public 
			
			
			
		 | 
		
		#
		__construct( array $params )
		
		
			Constructor. 
Initializes the logger. 
				Parameters
				
					- $params
 
					- Any parameters the backend might need.
 
				  
				Overrides
				
		 
		  | 
	
	
		
			 public 
			
			
			
		 | 
		
		#
		setUser( string $user )
		
			Sets the user used for this session. 
		 
		
			Sets the user used for this session. 
				Parameters
				
				Overrides
				
		 
		  | 
	
	
		
			 public 
			
			
			
		 | 
		
		#
		sessionStart( string $syncDeviceID, string $sessionId, integer $backendMode = Horde_SyncMl_Backend::MODE_SERVER )
		
		
			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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
					mixedTwo-element array with client anchor and server anchor as
               stored in previous writeSyncAnchor() calls. False if no
               data found. 
				 
				Overrides
				
		 
		  | 
	
	
		
			 public 
			array
			
			
		 | 
		
		#
		getUserAnchors( string $user )
		
			Returns all previously written sync anchors for a user. 
		 
		
			Returns all previously written sync anchors for a user. 
				Parameters
				
				Returns
				
					arrayA 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 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
				
		 
		  | 
	
	
		
			 public 
			
			
			
		 | 
		
		#
		testStart( string $user )
		
		
			Prepares the test start. 
				Parameters
				
					- $user
 
					- This user accout has to be created in the backend.
 
				  
				Overrides
				
		 
		  | 
	
	
		
			 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
				
		 
		  |