Changeset 0e11940 in github
- Timestamp:
- Dec 6, 2010 9:06:44 AM (2 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- d7e83d3
- Parents:
- 7472893
- Files:
-
- 3 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (7 diffs)
-
program/steps/settings/folders.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r7472893 r0e11940 16 16 - Improve performance of moving or copying of all messages in a folder 17 17 - Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206) 18 - Improve performance of folder rename and delete actions 18 19 19 20 RELEASE 0.5-BETA -
program/include/rcube_imap.php
r9e81b55 r0e11940 3019 3019 * Get mailbox size (size of all messages in a mailbox) 3020 3020 * 3021 * @param string $name Mailbox name 3021 * @param string $name Mailbox name 3022 3022 * @return int Mailbox size in bytes, False on error 3023 3023 */ … … 3094 3094 * @param string $mbox_name Mailbox to rename 3095 3095 * @param string $new_name New mailbox name 3096 * 3096 3097 * @return boolean True on success 3097 3098 */ … … 3103 3104 $mailbox = $this->mod_mailbox($mbox_name); 3104 3105 $abs_name = $this->mod_mailbox($new_name); 3105 3106 // check if mailbox is subscribed 3107 $a_subscribed = $this->_list_mailboxes(); 3108 $subscribed = in_array($mailbox, $a_subscribed); 3109 3110 // unsubscribe folder 3111 if ($subscribed) 3112 $this->conn->unsubscribe($mailbox); 3106 $delm = $this->get_hierarchy_delimiter(); 3107 3108 // get list of subscribed folders 3109 if ((strpos($mailbox, '%') === false) && (strpos($mailbox, '*') === false)) { 3110 $a_subscribed = $this->_list_mailboxes('', $mbox_name . $delm . '*'); 3111 $subscribed = $this->mailbox_exists($mbox_name, true); 3112 } 3113 else { 3114 $a_subscribed = $this->_list_mailboxes(); 3115 $subscribed = in_array($mailbox, $a_subscribed); 3116 } 3113 3117 3114 3118 if (strlen($abs_name)) … … 3116 3120 3117 3121 if ($result) { 3118 $delm = $this->get_hierarchy_delimiter(); 3122 // unsubscribe the old folder, subscribe the new one 3123 if ($subscribed) { 3124 $this->conn->unsubscribe($mailbox); 3125 $this->conn->subscribe($abs_name); 3126 } 3119 3127 3120 3128 // check if mailbox children are subscribed 3121 foreach ($a_subscribed as $c_subscribed) 3129 foreach ($a_subscribed as $c_subscribed) { 3122 3130 if (preg_match('/^'.preg_quote($mailbox.$delm, '/').'/', $c_subscribed)) { 3123 3131 $this->conn->unsubscribe($c_subscribed); … … 3125 3133 $abs_name, $c_subscribed)); 3126 3134 } 3135 } 3127 3136 3128 3137 // clear cache … … 3131 3140 } 3132 3141 3133 // try to subscribe it3134 if ($result && $subscribed)3135 $this->conn->subscribe($abs_name);3136 3137 3142 return $result; 3138 3143 } … … 3140 3145 3141 3146 /** 3142 * Remove mailboxes from server 3143 * 3144 * @param string|array $mbox_name Mailbox name(s) string/array 3147 * Remove mailbox from server 3148 * 3149 * @param string $mbox_name Mailbox name 3150 * 3145 3151 * @return boolean True on success 3146 3152 */ 3147 3153 function delete_mailbox($mbox_name) 3148 3154 { 3149 $deleted = false; 3150 3151 if (is_array($mbox_name)) 3152 $a_mboxes = $mbox_name; 3153 else if (is_string($mbox_name) && strlen($mbox_name)) 3154 $a_mboxes = explode(',', $mbox_name); 3155 3156 if (is_array($a_mboxes)) { 3157 $delimiter = $this->get_hierarchy_delimiter(); 3158 3159 foreach ($a_mboxes as $mbox_name) { 3160 $mailbox = $this->mod_mailbox($mbox_name); 3161 $sub_mboxes = $this->conn->listMailboxes('', $mbox_name . $delimiter . '*'); 3162 3163 // unsubscribe mailbox before deleting 3164 $this->conn->unsubscribe($mailbox); 3165 3166 // send delete command to server 3167 $result = $this->conn->deleteFolder($mailbox); 3168 if ($result) { 3169 $deleted = true; 3170 $this->clear_message_cache($mailbox.'.msg'); 3171 } 3172 3173 foreach ($sub_mboxes as $c_mbox) { 3174 if ($c_mbox != 'INBOX') { 3175 $this->conn->unsubscribe($c_mbox); 3176 $result = $this->conn->deleteFolder($c_mbox); 3177 if ($result) { 3178 $deleted = true; 3179 $this->clear_message_cache($c_mbox.'.msg'); 3180 } 3155 $result = false; 3156 $mailbox = $this->mod_mailbox($mbox_name); 3157 $delm = $this->get_hierarchy_delimiter(); 3158 3159 // get list of folders 3160 if ((strpos($mailbox, '%') === false) && (strpos($mailbox, '*') === false)) 3161 $sub_mboxes = $this->list_unsubscribed('', $mailbox . $delm . '*'); 3162 else 3163 $sub_mboxes = $this->list_unsubscribed(); 3164 3165 // send delete command to server 3166 $result = $this->conn->deleteFolder($mailbox); 3167 3168 if ($result) { 3169 // unsubscribe mailbox 3170 $this->conn->unsubscribe($mailbox); 3171 3172 foreach ($sub_mboxes as $c_mbox) { 3173 if (preg_match('/^'.preg_quote($mailbox.$delm, '/').'/', $c_mbox)) { 3174 $this->conn->unsubscribe($c_mbox); 3175 if ($this->conn->deleteFolder($c_mbox)) { 3176 $this->clear_message_cache($c_mbox.'.msg'); 3181 3177 } 3182 3178 } 3183 3179 } 3184 } 3185 3186 // clear mailboxlist cache 3187 if ($deleted) 3180 3181 // clear mailbox-related cache 3182 $this->clear_message_cache($mailbox.'.msg'); 3188 3183 $this->clear_cache('mailboxes'); 3189 3190 return $deleted; 3184 } 3185 3186 return $result; 3191 3187 } 3192 3188 -
program/steps/settings/folders.inc
raf3c045e r0e11940 66 66 else if ($RCMAIL->action == 'delete-folder') 67 67 { 68 $a_mboxes = $IMAP->list_unsubscribed();69 $delimiter = $IMAP->get_hierarchy_delimiter();70 71 68 $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); 72 69 $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); 73 70 71 // get folder's children or all folders if the name contains special characters 72 $delimiter = $IMAP->get_hierarchy_delimiter(); 73 if ((strpos($mbox, '%') === false) && (strpos($mbox, '*') === false)) 74 $a_mboxes = $IMAP->list_unsubscribed('', $mbox.$delimiter.'*'); 75 else 76 $a_mboxes = $IMAP->list_unsubscribed(); 77 74 78 if (strlen($mbox)) 75 $deleted = $IMAP->delete_mailbox( array($mbox));79 $deleted = $IMAP->delete_mailbox($mbox); 76 80 77 81 if ($OUTPUT->ajax_call && $deleted) { 78 // Remove folder rows82 // Remove folder and subfolders rows 79 83 $OUTPUT->command('remove_folder_row', $mbox_utf8); 80 84 foreach ($a_mboxes as $folder) { … … 122 126 123 127 $before = isset($folderlist[$x+1]) ? rcube_charset_convert($folderlist[$x+1], 'UTF7-IMAP') : false; 124 128 125 129 $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldfolder, 'UTF7-IMAP'), 126 130 rcube_charset_convert($folderlist[$x], 'UTF7-IMAP'), $display_rename, $before);
Note: See TracChangeset
for help on using the changeset viewer.
