summaryrefslogtreecommitdiff
path: root/lib/kolab_sync_data_email.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-01-02 12:30:31 (GMT)
committerAleksander Machniak <alec@alec.pl>2014-01-02 12:30:31 (GMT)
commite46f49b16a35c3cd01c492d022f6965be3fe408e (patch)
treedea57d89b58db68252bb4b912206e2649d20c351 /lib/kolab_sync_data_email.php
parente364866f45c02298862c7d60141c9e9aab6827d0 (diff)
downloadkolab-syncroton-e46f49b16a35c3cd01c492d022f6965be3fe408e.tar.gz
Improve errors handling to prevent removing all objects from the device (Bug #2698)
Diffstat (limited to 'lib/kolab_sync_data_email.php')
-rw-r--r--lib/kolab_sync_data_email.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index 18b8b54..3d7f835 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -779,6 +779,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$result = $result_type == self::RESULT_COUNT ? 0 : array();
// no sorting for best performance
$sort_by = null;
+ $found = 0;
foreach ($folders as $folder_id) {
$foldername = $this->backend->folder_id2name($folder_id, $this->device->deviceid);
@@ -787,6 +788,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
continue;
}
+ $found++;
+
$this->storage->set_folder($foldername);
// Syncronize folder (if it wasn't synced in this request already)
@@ -837,8 +840,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$search = $this->storage->search_once($foldername, $filter_str);
- if (!($search instanceof rcube_result_index)) {
- continue;
+ if (!($search instanceof rcube_result_index) || $search->is_error()) {
+ throw new Syncroton_Exception_Status(Syncroton_Exception_Status::SERVER_ERROR);
}
switch ($result_type) {
@@ -864,6 +867,10 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
}
}
+ if (!$found) {
+ throw new Syncroton_Exception_Status(Syncroton_Exception_Status::SERVER_ERROR);
+ }
+
if (!empty($modseq_update)) {
$this->backend->modseq_set($this->device->id, $folderid,
$this->syncTimeStamp, $modseq_data);