summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-03 15:30:02 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-03 15:30:02 (GMT)
commit948a68136dc7e101036dee6ace927803adb31220 (patch)
tree783a6bf3eab0399292d7c82102a08ef87056021a
parent8dba73549d4dc4afbebb5abf229e112382e3a5b2 (diff)
downloadroundcubemail-plugins-kolab-948a68136dc7e101036dee6ace927803adb31220.tar.gz
Handle possible errors from kolab_storage::get_folder() access (#4378)
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache.php37
1 files changed, 24 insertions, 13 deletions
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 134631e..f0eeb1a 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -271,7 +271,12 @@ class kolab_storage_cache
{
// delegate to another cache instance
if ($foldername && $foldername != $this->folder->name) {
- return kolab_storage::get_folder($foldername)->cache->get($msguid, $type);
+ $success = false;
+ if ($targetfolder = kolab_storage::get_folder($foldername)) {
+ $success = $targetfolder->cache->get($msguid, $type);
+ $this->error = $targetfolder->cache->get_error();
+ }
+ return $success;
}
// load object if not in memory
@@ -320,8 +325,11 @@ class kolab_storage_cache
// delegate to another cache instance
if ($foldername && $foldername != $this->folder->name) {
- kolab_storage::get_folder($foldername)->cache->set($msguid, $object);
- return;
+ if ($targetfolder = kolab_storage::get_folder($foldername)) {
+ $targetfolder->cache->set($msguid, $object);
+ $this->error = $targetfolder->cache->get_error();
+ }
+ return;
}
// remove old entry
@@ -474,17 +482,20 @@ class kolab_storage_cache
return;
}
- $target = kolab_storage::get_folder($new_folder);
-
- // resolve new message UID in target folder
- $this->db->query(
- "UPDATE `{$this->folders_table}` SET `resource` = ? ".
- "WHERE `resource` = ?",
- $target->get_resource_uri(),
- $this->resource_uri
- );
+ if ($target = kolab_storage::get_folder($new_folder)) {
+ // resolve new message UID in target folder
+ $this->db->query(
+ "UPDATE `{$this->folders_table}` SET `resource` = ? ".
+ "WHERE `resource` = ?",
+ $target->get_resource_uri(),
+ $this->resource_uri
+ );
- $this->check_error();
+ $this->check_error();
+ }
+ else {
+ $this->error = kolab_storage::ERROR_IMAP_CONN;
+ }
}
/**