Roundcube Community Forum

SVN Releases => Issues & Bugs => Topic started by: hrayr on January 15, 2016, 05:12:31 PM

Title: 'default_imap_folders' - config
Post by: hrayr on January 15, 2016, 05:12:31 PM

On debian-linux server I have installed the roundcube-0.9.5, and in config file exist
the 'default_imap_folders' option, the value is " array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash', 'Spam', 'SpecialFolder'); "

right after that option exist this one also 'create_default_folders', with the value 'true'.

When new user is created and that user do login the first time, the folders specified in 'default_imap_folders' option, will be automaticaly created.
It works fine.

On another debian linux I have installed the new version of roundcube-1.1.4 .
In the config file of 'roundcube-1.1.4' the option 'create_default_folders' exist, but the 'default_imap_folders' doesn't exist.
I have manually added the 'default_imap_folders', but it seems that it doesn't have any effect.

May be it is some bug? or the option name is changed in new version? or now the same functionalty is achieved by another technics?

Title: Re: 'default_imap_folders' - config
Post by: SKaero on January 15, 2016, 06:46:26 PM
Note that the configuration variable changed from $rcmail_config to $config between 0.9.x and 1.0.x
Title: Re: 'default_imap_folders' - config
Post by: hrayr on January 15, 2016, 07:40:28 PM
Yes, I know, I wrote in config file:
$config['default_imap_folders']=array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash', 'Spam', 'SpecialFolder');

The strange thing that the command:

cd ./root_folder_of_roundcube_sources_and_files; grep -i default_imap_folders -R *

doesn't return anything, it means that 'default_imap_folders' -string doesn't exist in any file of roundcube sources or configs.

So, if this option is removed, what can be alternative of that functionality (i.e. create some folders automatically, instead of creating or subscribing them manually for each account)

Title: Re: 'default_imap_folders' - config
Post by: SKaero on January 16, 2016, 03:10:09 AM
So went looking and found that the default_imap_folders option was renamed to default_folders in Roundcube 0.8 and then it was removed in Roundcube 1.1
Title: Re: 'default_imap_folders' - config
Post by: hrayr on January 16, 2016, 06:22:29 PM
SKaero thank you for your reply, I have read your posts, the functionality really was removed in 1.1 versions.

As I understood in the "program/lib/Roundcube/rcube_storage.php" the class "rcube_storage" has
variable "public static $folder_types = array('drafts', 'sent', 'junk', 'trash');" which is later foreached and the default folders are created.
So, if we will define additional folders (f.x. public static $folder_types = array('drafts', 'sent', 'junk', 'trash','folder2','folder2'); ),
and also in config file we will define that folders in such format "$config['folder1_mbox']='folder1'; $config['folder2_mbox']='folder2'; ", the problem should be solved.

But adding something in main functions (f.x. in 'program/lib/Roundcube/rcube_storage.php' ), are not good practice.
Taking into account that roundcube config file is not only config file, but also PHP parseable file,
it will be nice to add something only in config file, and don't touch the "program/lib/Roundcube/rcube_storage.php".

So, this one is more desirable solution, without touching any main function, and writing something only in config file:
add in config file these 4 lines:

// these lines will just append the existing array, when the config file will be parsed.

// these lines will work, because the final "$folder_types" variable already will contain the new defined folders
$config['folder1_mbox'] = 'folder1';
$config['folder2_mbox'] = 'folder2';

The example works on my server.

Title: Re: 'default_imap_folders' - config
Post by: JohnDoh on January 17, 2016, 04:02:11 AM
Plugins can add folder types. There is a plugin called "archive" which is shipped with Roundcube which has an example of this.