Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117756006
D5673.1775204781.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D5673.1775204781.diff
View Options
diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -857,12 +857,17 @@
* @param string $filter Data type to list folders for (contact,event,task,journal,file,note,mail,configuration)
* @param bool $subscribed Enable to return subscribed folders only (null to use configured subscription mode)
* @param array $folderdata Will be filled with folder-types data
+ * @param bool $abortOnError Abort on error
*
* @return array List of folders
*/
- public static function list_folders($root = '', $mbox = '*', $filter = null, $subscribed = null, &$folderdata = [])
+ public static function list_folders($root = '', $mbox = '*', $filter = null, $subscribed = null, &$folderdata = [], $abortOnError = false)
{
if (!self::setup()) {
+ rcube::raise_error([
+ 'code' => 900, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Failed to init"
+ ], true, $abortOnError);
return [];
}
@@ -879,6 +884,13 @@
$folders = self::_imap_list_folders($root, $mbox);
}
+ if (self::$imap->get_error_code()) {
+ rcube::raise_error([
+ 'code' => 900, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "IMAP error: " . self::$imap->get_error_str()
+ ], true, $abortOnError);
+ }
+
return $folders;
}
$prefix = $root . $mbox;
@@ -887,7 +899,11 @@
// get folders types for all folders
$folderdata = self::folders_typedata($prefix);
- if (!is_array($folderdata)) {
+ if (!is_array($folderdata) || self::$imap->get_error_code()) {
+ rcube::raise_error([
+ 'code' => 900, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "IMAP error: " . self::$imap->get_error_str()
+ ], true, $abortOnError);
return [];
}
@@ -911,7 +927,11 @@
}
// In case of an error, return empty list (?)
- if (!is_array($folders)) {
+ if (!is_array($folders) || self::$imap->get_error_code()) {
+ rcube::raise_error([
+ 'code' => 900, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "IMAP error: " . self::$imap->get_error_str()
+ ], true, $abortOnError);
return [];
}
diff --git a/plugins/libkolab/lib/kolab_subscriptions.php b/plugins/libkolab/lib/kolab_subscriptions.php
--- a/plugins/libkolab/lib/kolab_subscriptions.php
+++ b/plugins/libkolab/lib/kolab_subscriptions.php
@@ -99,7 +99,7 @@
$result = array_map([$this, 'dav_folder_prop'], $result);
}
} else {
- $result = kolab_storage::list_folders('', '*', $type, false);
+ $result = kolab_storage::list_folders('', '*', $type, false, [], true);
$result = array_map([$this, 'imap_folder_prop'], $result);
}
@@ -161,6 +161,15 @@
$devicetype = $this->imei_to_type($deviceid);
$folders = $this->list_folders($type);
+
+ // Sanity check, we should always have at least inbox
+ if ((!$type || ($type == "mail")) && emtpy($folders)) {
+ rcube::raise_error([
+ 'code' => 500, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Empty mail folder list should not be possible."
+ ], true, true);
+ }
+
// Verify if subscribed folders still exist
if (!empty($result)) {
foreach ($result as $idx => $flag) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 8:26 AM (9 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823223
Default Alt Text
D5673.1775204781.diff (3 KB)
Attached To
Mode
D5673: Avoid resetting subscriptions if we fail to list the folders
Attached
Detach File
Event Timeline