diff options
author | alecpl <alec@alec.pl> | 2010-12-06 14:06:44 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-12-06 14:06:44 +0000 |
commit | 0e11940a65777b8dd22d017da472c2dc373d650c (patch) | |
tree | 30a2c782505f0c53b5740f602ea8e6f55621eda7 /program/steps/settings/folders.inc | |
parent | 74728935122fe35ed97c40092080cc7dfd4b7052 (diff) |
- Improve performance of folder rename and delete actions. Don't get list of all folders when we need only children of the specified folder.
Diffstat (limited to 'program/steps/settings/folders.inc')
-rw-r--r-- | program/steps/settings/folders.inc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index b90487a07..1ceca7416 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -65,17 +65,21 @@ else if ($RCMAIL->action == 'unsubscribe') // delete an existing mailbox else if ($RCMAIL->action == 'delete-folder') { - $a_mboxes = $IMAP->list_unsubscribed(); - $delimiter = $IMAP->get_hierarchy_delimiter(); - $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); + // get folder's children or all folders if the name contains special characters + $delimiter = $IMAP->get_hierarchy_delimiter(); + if ((strpos($mbox, '%') === false) && (strpos($mbox, '*') === false)) + $a_mboxes = $IMAP->list_unsubscribed('', $mbox.$delimiter.'*'); + else + $a_mboxes = $IMAP->list_unsubscribed(); + if (strlen($mbox)) - $deleted = $IMAP->delete_mailbox(array($mbox)); + $deleted = $IMAP->delete_mailbox($mbox); if ($OUTPUT->ajax_call && $deleted) { - // Remove folder rows + // Remove folder and subfolders rows $OUTPUT->command('remove_folder_row', $mbox_utf8); foreach ($a_mboxes as $folder) { if (preg_match('/^'. preg_quote($mbox.$delimiter, '/') .'/', $folder)) { @@ -121,7 +125,7 @@ else if ($RCMAIL->action == 'rename-folder') . rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'); $before = isset($folderlist[$x+1]) ? rcube_charset_convert($folderlist[$x+1], 'UTF7-IMAP') : false; - + $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldfolder, 'UTF7-IMAP'), rcube_charset_convert($folderlist[$x], 'UTF7-IMAP'), $display_rename, $before); } |