Projects
Kolab:16:Enterprise
kolab-syncroton
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 72
View file
kolab-syncroton.spec
Changed
@@ -43,7 +43,7 @@ %global upstream_version 2.4.2 Name: kolab-syncroton -Version: 2.4.2.34 +Version: 2.4.2.35 Release: 1%{?dist} Summary: ActiveSync for Kolab Groupware
View file
debian.changelog
Changed
@@ -1,4 +1,4 @@ -kolab-syncroton (2.4.2.34-0~kolab1) unstable; urgency=low +kolab-syncroton (2.4.2.35-0~kolab1) unstable; urgency=low * Release version 2.4.2
View file
kolab-syncroton-2.4.2.tar.gz/docs/SQL/mysql.initial.sql
Changed
@@ -47,6 +47,7 @@ `creation_synckey` int(11) NOT NULL DEFAULT '0', `lastfiltertype` int(11) DEFAULT NULL, `supportedfields` longblob DEFAULT NULL, + `resync` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `device_id--class--folderid` (`device_id`(40),`class`(40),`folderid`(40)), KEY `folderstates::device_id--devices::id` (`device_id`),
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_storage.php
Changed
@@ -1982,8 +1982,25 @@ $folderid, $synctime ); + $row = $db->fetch_assoc(); + if (!$row) { + // Only if we don't have a timestamp that is older than synctime do we return the next best. + // We MUST return an entry if there are any, because otherwise we will keep INSERTing new entries in, + // relations_state_set + $db->limitquery( + "SELECT `data`, `synctime` FROM `syncroton_relations_state`" + . " WHERE `device_id` = ? AND `folder_id` = ?" + . " ORDER BY `synctime` ASC", + 0, + 1, + $device_key, + $folderid, + $synctime + ); + $row = $db->fetch_assoc(); + } - if ($row = $db->fetch_assoc()) { + if ($row) { // Don't use $row'synctime' for the internal cache. // The synctime of the found row is usually earlier than the requested synctime. // Note: We use internal cache because there's a call to both hasChanges() and
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/RelationsTest.php
Changed
@@ -50,6 +50,23 @@ return $this->request($request, 'Sync'); } + private function getRelationsState($device_id, $folderId) + { + $db = \rcube::get_instance()->get_dbh(); + $result = $db->query( + "SELECT `data`, `synctime` FROM `syncroton_relations_state`" + . " WHERE `device_id` = ? AND `folder_id` = ?" + . " ORDER BY `synctime` DESC", + $device_id, + $folderId + ); + $data = ; + while ($state = $db->fetch_assoc($result)) { + $data = $state; + } + return $data; + } + /** * Test Sync command */ @@ -146,20 +163,7 @@ $this->assertSame("test1test2", $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->item(0)->nodeValue); // Assert the db state - $rcube = \rcube::get_instance(); - $db = $rcube->get_dbh(); - $result = $db->query( - "SELECT `data`, `synctime` FROM `syncroton_relations_state`" - . " WHERE `device_id` = ? AND `folder_id` = ?" - . " ORDER BY `synctime` DESC", - $device'ID', - $folderId - ); - $data = ; - while ($state = $db->fetch_assoc($result)) { - $data = $state; - } - $this->assertSame(2, count($data)); + $this->assertSame(2, count($this->getRelationsState($device'ID', $folderId))); // Make sure we have a new timestamp after the first iteration. // This way we can potentially catch errors when we end up using the same or a different timestamp. sleep(1); @@ -188,18 +192,7 @@ // Assert the db state - $result = $db->query( - "SELECT `data`, `synctime` FROM `syncroton_relations_state`" - . " WHERE `device_id` = ? AND `folder_id` = ?" - . " ORDER BY `synctime` DESC", - $device'ID', - $folderId - ); - $data = ; - while ($state = $db->fetch_assoc($result)) { - $data = $state; - } - $this->assertSame(2, count($data)); + $this->assertSame(2, count($this->getRelationsState($device'ID', $folderId))); $response = $this->syncRequest($syncKey, $folderId, 10); $this->assertEquals(200, $response->getStatusCode()); @@ -209,4 +202,78 @@ return $syncKey; } + + public function testPing() + { + // Setup with a tag and an initial sync completed + $folderId = '38b950ebd62cd9a66929c89615d0fc04'; + $sync = \kolab_sync::get_instance(); + $device = $sync->storage()->device_get(self::$deviceId); + + $uid1 = $this->appendMail('INBOX', 'mail.sync1'); + $sync->storage()->updateItem($folderId, $device'ID', \kolab_sync_storage::MODEL_EMAIL, $uid1, null, 'categories' => 'test1'); + sleep(1); + + $response = $this->syncRequest(0, $folderId, 10); + $this->assertEquals(200, $response->getStatusCode()); + $response = $this->syncRequest(1, $folderId, 10); + $this->assertEquals(200, $response->getStatusCode()); + + + $this->assertSame(2, count($this->getRelationsState($device'ID', $folderId))); + + // Make sure the timestamp changes + sleep(1); + + // Pings should not change the number of relation states + for ($i=0; $i < 2; $i++) { + $request = <<<EOF + <?xml version="1.0" encoding="utf-8"?> + <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> + <Ping xmlns="uri:Ping"> + <HeartbeatInterval>0</HeartbeatInterval> + <Folders> + <Folder> + <Id>$folderId</Id> + <Class>Email</Class> + </Folder> + </Folders> + </Ping> + EOF; + + $response = $this->request($request, 'Ping'); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertSame(1, count($this->getRelationsState($device'ID', $folderId))); + } + + // This simulates a specific case where we had: + // * An old lastsync timestamp (because the folders were not actively synchronized) + // * The folder was still included in the ping command + // => This resulted in the relations code never finding a relation, and thus not cleaning up, but it still inserted new entries + $db = \rcube::get_instance()->get_dbh(); + $result = $db->query( + "UPDATE `syncroton_synckey` SET `lastsync` = '2023-06-23 13:15:03'" + ); + + $request = <<<EOF + <?xml version="1.0" encoding="utf-8"?> + <!DOCTYPE AirSync PUBLIC "-//AIRSYNC//DTD AirSync//EN" "http://www.microsoft.com/"> + <Ping xmlns="uri:Ping"> + <HeartbeatInterval>0</HeartbeatInterval> + <Folders> + <Folder> + <Id>$folderId</Id> + <Class>Email</Class> + </Folder> + </Folders> + </Ping> + EOF; + + $response = $this->request($request, 'Ping'); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertSame(1, count($this->getRelationsState($device'ID', $folderId))); + + } }
View file
kolab-syncroton.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-syncroton Binary: kolab-syncroton Architecture: all -Version: 1:2.4.2.34-1~kolab1 +Version: 1:2.4.2.35-1~kolab1 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Homepage: http://www.kolab.org/
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
.