2 commits - lib/ext lib/kolab_sync_data_email.php
Aleksander Machniak
machniak at kolabsys.com
Thu Jan 3 09:28:43 CET 2013
lib/ext/Syncroton/Command/Ping.php | 23 +++++++++++++++++------
lib/kolab_sync_data_email.php | 4 ++--
2 files changed, 19 insertions(+), 8 deletions(-)
New commits:
commit e3369ae890278d65bef58fc192de8290806f371e
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Jan 3 09:28:12 2013 +0100
Handle "folder not found" exception in Ping command (Bug #1390)
diff --git a/lib/ext/Syncroton/Command/Ping.php b/lib/ext/Syncroton/Command/Ping.php
index 52a2140..3270d53 100644
--- a/lib/ext/Syncroton/Command/Ping.php
+++ b/lib/ext/Syncroton/Command/Ping.php
@@ -113,10 +113,21 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
$now = new DateTime('now', new DateTimeZone('utc'));
foreach ((array) $folders as $folderId) {
- $folder = $this->_folderBackend->get($folderId);
-
- $dataController = Syncroton_Data_Factory::factory($folder->class, $this->_device, $this->_syncTimeStamp);
-
+ try {
+ $folder = $this->_folderBackend->get($folderId);
+ $dataController = Syncroton_Data_Factory::factory($folder->class, $this->_device, $this->_syncTimeStamp);
+ } catch (Syncroton_Exception_NotFound $e) {
+ if ($this->_logger instanceof Zend_Log)
+ $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+ $status = self::STATUS_FOLDER_NOT_FOUND;
+ break;
+ } catch (Exception $e) {
+ if ($this->_logger instanceof Zend_Log)
+ $this->_logger->err(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+ // do nothing, maybe temporal issue, should we stop?
+ continue;
+ }
+
try {
$syncState = $this->_syncStateBackend->getSyncState($this->_device, $folder);
@@ -148,7 +159,7 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
}
}
- if ($status === self::STATUS_CHANGES_FOUND) {
+ if ($status != self::STATUS_NO_CHANGES_FOUND) {
break;
}
@@ -173,7 +184,7 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
if ($this->_logger instanceof Zend_Log)
$this->_logger->info(__METHOD__ . '::' . __LINE__ . " DeviceId: " . $this->_device->deviceid . " changes in folder: " . $changedFolder->serverId);
}
- }
+ }
}
/**
commit 30e5b34a7858549d68a8a64a7e7a974fa9af6357
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Jan 3 08:58:14 2013 +0100
Make body truncation multibyte aware (Bug #1390)
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index a7a468a..769d472 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -273,8 +273,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
if ($truncateAt !== null) {
if ($body_length > $truncateAt) {
- $messageBody = substr($messageBody, 0, $truncateAt);
- $body_length = $truncateAt;
+ $messageBody = mb_strcut($messageBody, 0, $truncateAt);
+ $body_length = strlen($truncateAt);
}
$isTruncacted = 1;
}
More information about the commits
mailing list