Performance fix: Do not ask for folder attributes if we know that folder do not exists

pull/89/head
Aleksander Machniak 12 years ago
parent d3d1e38d72
commit e89d8f1fec

@ -232,16 +232,16 @@ function rcube_subscription_form($attrib)
// add any necessary "virtual" parent folders // add any necessary "virtual" parent folders
if ($parent_folder && !isset($seen[$parent_folder])) { if ($parent_folder && !isset($seen[$parent_folder])) {
for ($i=1; $i<=$level; $i++) { for ($i=1; $i<=$level; $i++) {
$ancestor_folder = join($delimiter, array_slice($foldersplit, 0, $i)); $ancestor_folder = join($delimiter, array_slice($foldersplit, 0, $i));
if ($ancestor_folder && !$seen[$ancestor_folder]++) { if ($ancestor_folder && !$seen[$ancestor_folder]++) {
$ancestor_name = rcube_charset_convert($foldersplit[$i-1], 'UTF7-IMAP'); $ancestor_name = rcube_charset_convert($foldersplit[$i-1], 'UTF7-IMAP');
$list_folders[] = array( $list_folders[] = array(
'id' => $ancestor_folder, 'id' => $ancestor_folder,
'name' => $ancestor_name, 'name' => $ancestor_name,
'level' => $i-1, 'level' => $i-1,
'virtual' => true, 'virtual' => true,
); );
} }
} }
} }
@ -291,9 +291,11 @@ function rcube_subscription_form($attrib)
$classes[] = 'virtual'; $classes[] = 'virtual';
} }
if (!$protected) { // Check \Noselect flag (of existing folder)
$attrs = $STORAGE->folder_attributes($folder['id']); if (!$protected && in_array($folder['id'], $a_unsubscribed)) {
$noselect = in_array('\\Noselect', $attrs); $attrs = $STORAGE->folder_attributes($folder['id']);
$noselect = in_array('\\Noselect', $attrs);
}
} }
$disabled = (($protected && $subscribed) || $noselect); $disabled = (($protected && $subscribed) || $noselect);

Loading…
Cancel
Save