[dev] Renaming folders with sub-folders...
Gary Windham
windhamg at email.arizona.edu
Wed Feb 25 10:53:22 PST 2004
Quoting Michael M Slusarz <slusarz at bigworm.colorado.edu>:
> Quoting Gary Windham <windhamg at email.arizona.edu>:
>
>> Quoting Michael M Slusarz <slusarz at bigworm.colorado.edu>:
>>
>>> Quoting Gary Windham <windhamg at email.arizona.edu>:
>>>
>>>> I confirmed this behavior, using Cyrus IMAP 2.1.14. Reloading the
>>>> folder list
>>>> resulted in the original "test" folder disappearing, so this
>>>> appears to be a
>>>> cache issue.
>>>
>>> Try what I just committed.
>>
>> Works for me...except for a couple of weird edge conditions. I almost
>> hesitate
>> to mention them, but they're just too weird.
>>
>> If I have a folder hierarchy a/<anything>, where the top-level folder is
>> *literally* called "a", then the folder rename operation fails. If the
>> top-level folder is called "b", or "x", or "aa", "cucumber", or *anything*
>> else, then the rename succeeds.
>
> That is strange - can't replicate that here. Chuck's post possibly explains
> this one though...
>
>> The second condition is if I have a folder hierarchy "test1/test1", then
>> renaming the top-level folder to "test2" results in the subfolder being
>> renamed
>> to "test2" as well. That is, "test1/test1" becomes "test2/test2".
>
> Can't replicate this, using courier-imap 2.2.0 (i.e., test0/test0,
> selecting the
> base test0, changing the name test1, results in a tree of test1/test0).
OK, I traced down the cause of both these problems, but I am puzzled as to why
you weren't able to replicate them.
Line 519 in imp/lib/Folder.php (inside function rename()) reads:
$folder_new = str_replace($old, $new, $folder_old);
Since $folder_old, is going to be a fully-qualified folder path (with
the server
prefix), it's easy to see how the above str_replace() will munge the
new folder
name for the following case:
$old = 'a';
$new = 'x';
$folder_old = '{inbox.email.arizona.edu:143/imap/notls}a';
After the above call to str_replace(), $folder_new becomes
'inbox.emxil.xrizonx.edu:143/imxp/notls}x'. imap_renamemailbox() subsequently
barfs. :)
The other case (test1/test1 => test2/test2) also appears to be caused by this
same call to str_replace(). The variables in this case are:
$old = 'test1';
$new = 'test2';
$folder_old = '{inbox.email.arizona.edu:143/imap/notls}test1/test1';
$folder_new becomes '{inbox.email.arizona.edu:143/imap/notls}test2/test2';
Thanks,
--Gary
--
Gary Windham
Systems Programmer, Principal
The University of Arizona, CCIT
More information about the dev
mailing list