Projects
Kolab:16:Testing
kolab-syncroton
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 14
View file
kolab-syncroton-2.4.0.tar.gz/lib/kolab_sync_backend_common.php
Changed
@@ -81,8 +81,8 @@ * * @param Syncroton_Model_* $object Object * - * @throws InvalidArgumentException * @return Syncroton_Model_* Object + * @throws InvalidArgumentException|Syncroton_Exception_DeadlockDetected|Exception */ public function create($object) { @@ -105,11 +105,11 @@ ); if ($err = $this->db->is_error($result)) { - //Deadlock detected + $err = "Failed to save instance of {$this->interface_name}: {$err}"; if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected('Failed to save instance of ' . $this->interface_name . ": " . $err); + throw new Syncroton_Exception_DeadlockDetected($err); } else { - throw new Exception('Failed to save instance of ' . $this->interface_name . ": " . $err); + throw new Exception($err); } } @@ -145,6 +145,7 @@ * @param string|Syncroton_Model_* $id Object or identifier * * @return bool True on success, False on failure + * @throws Syncroton_Exception_DeadlockDetected|Exception */ public function delete($id) { @@ -157,11 +158,11 @@ $result = $this->db->query('DELETE FROM `' . $this->table_name .'` WHERE `id` = ?', array($id)); if ($err = $this->db->is_error($result)) { - //Deadlock detected + $err = "Failed to delete instance of {$this->interface_name}: {$err}"; if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected('Failed to delete instance of ' . $this->interface_name . ": " . $err); + throw new Syncroton_Exception_DeadlockDetected($err); } else { - throw new Exception('Failed to delete instance of ' . $this->interface_name . ": " . $err); + throw new Exception($rr); } } @@ -173,8 +174,8 @@ * * @param Syncroton_Model_* $object * - * @throws InvalidArgumentException * @return Syncroton_Model_* Object + * @throws InvalidArgumentException|Syncroton_Exception_DeadlockDetected|Exception */ public function update($object) { @@ -191,12 +192,13 @@ $result = $this->db->query('UPDATE `' . $this->table_name . '` SET ' . implode(', ', $set) . ' WHERE `id` = ' . $this->db->quote($object->id), array_values($data)); + if ($err = $this->db->is_error($result)) { - //Deadlock detected + $err = "Failed to update instance of {$this->interface_name}: {$err}"; if ($this->db->error_info()0 == '40001') { - throw new Syncroton_Exception_DeadlockDetected('Failed to update instance of ' . $this->interface_name . ": " . $err); + throw new Syncroton_Exception_DeadlockDetected($err); } else { - throw new Exception('Failed to update instance of ' . $this->interface_name . ": " . $err); + throw new Exception($err); } }
View file
kolab-syncroton-2.4.0.tar.gz/lib/kolab_sync_backend_content.php
Changed
@@ -55,6 +55,7 @@ * @param Syncroton_Model_IDevice|string $_deviceId * @param Syncroton_Model_IFolder|string $_folderId * @param string $_contentId + * * @return Syncroton_Model_IContent */ public function getContentState($_deviceId, $_folderId, $_contentId) @@ -82,13 +83,15 @@ * * @param Syncroton_Model_IDevice|string $_deviceId * @param Syncroton_Model_IFolder|string $_folderId + * @param int $syncKey + * * @return array */ public function getFolderState($_deviceId, $_folderId, $syncKey = null) { $deviceId = $_deviceId instanceof Syncroton_Model_IDevice ? $_deviceId->id : $_deviceId; $folderId = $_folderId instanceof Syncroton_Model_IFolder ? $_folderId->id : $_folderId; - $cachekey = $deviceId . ':' . $folderId; + $cachekey = $deviceId . ':' . $folderId . ':' . ($syncKey ?: '*'); // in Sync request we call this function twice in case when // folder state changed - use cache to skip at least one SELECT query @@ -98,10 +101,10 @@ $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($deviceId); $where = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folderId); + $where = $this->db->quote_identifier('is_deleted') . ' = 0'; if ($syncKey) { $where = $this->db->quote_identifier('creation_synckey') . ' < ' . $this->db->quote($syncKey + 1); } - $where = $this->db->quote_identifier('is_deleted') . ' = 0'; $select = $this->db->query("SELECT `contentid` FROM `{$this->table_name}` WHERE " . implode(' AND ', $where)); $result = array(); @@ -123,9 +126,8 @@ { $deviceId = $_deviceId instanceof Syncroton_Model_IDevice ? $_deviceId->id : $_deviceId; $folderId = $_folderId instanceof Syncroton_Model_IFolder ? $_folderId->id : $_folderId; - $cachekey = $deviceId . ':' . $folderId; - unset($this->cache'content_folderstate'$cachekey); + unset($this->cache'content_folderstate'); $where = $this->db->quote_identifier('device_id') . ' = ' . $this->db->quote($deviceId); $where = $this->db->quote_identifier('folder_id') . ' = ' . $this->db->quote($folderId);
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.