summaryrefslogtreecommitdiff
path: root/plugins/archive
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-30 09:47:56 +0100
committerAleksander Machniak <alec@alec.pl>2013-10-30 09:47:56 +0100
commit2143a648734fe631bcab8516ca8f08128dd6a735 (patch)
treea5c199fcb44de51aa4ab4aa6a74326011ccbd61d /plugins/archive
parentd72a41dc8e9bf523b45e04d4226f63fb7502c349 (diff)
Performance improvement - call IMAP LIST only once
Diffstat (limited to 'plugins/archive')
-rw-r--r--plugins/archive/archive.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php
index 4ef46e4f4..420f6918b 100644
--- a/plugins/archive/archive.php
+++ b/plugins/archive/archive.php
@@ -170,7 +170,9 @@ class archive extends rcube_plugin
// create archive subfolder if it doesn't yet exist
// we'll create all folders in the path
if (!in_array($folder, $folders)) {
- $list = $storage->list_folders('', $archive_folder . '*', 'mail', null, true);
+ if (empty($list)) {
+ $list = $storage->list_folders('', $archive_folder . '*', 'mail', null, true);
+ }
$path = explode($delimiter, $folder);
for ($i=0; $i<count($path); $i++) {
@@ -178,6 +180,7 @@ class archive extends rcube_plugin
if (!in_array($_folder, $list)) {
if ($storage->create_folder($_folder, true)) {
$result['reload'] = true;
+ $list[] = $_folder;
}
}
}