Search code examples
apacheubuntucoldfusioncoldfusion-9case-sensitive

Make ColdFusion on Ubuntu case-insensitive


I've installed apache2 and ColdFusion 9 on an Ubuntu 12.04 box. I've already use the CheckSpelling mod in Apache to disable case-sensitive URLs and other paths that Apache is responsible for.

Now, keep in mind, I'm working with about 4GB of legacy code (about 6 years worth) and very little is up to convention. The coders before me were not concerned with case sensitivity, seeing as how the application was hosted on a Windows Box. For the most part, ColdFusion is behaving with <cfinclude> and CreateObject, but it seems like <cfinvoke> (which is used quite often in the codebase) is still case sensitive.

Now, I've tried the method of moving the code onto a vfat partition, but what I ran into was a whole bunch of encoding issues with filenames (we deal with foreign companies and get a lot of special characters). Deleting and/or renaming the files would be cumbersome, as most are also referred to in the MySQL database, and would have to be modified there as well. So recoding is somewhat of a nightmare.

So, I'm curious if ColdFusion has any special flags when running on Linux to be case insensitive, or if there is another method for making this all come together?

EDIT

I'm Sorry, I was mistaken. cfinvoke seems to work ok. I'm choking on cfobject


Solution

  • I did some research, and this is what I came up with...

    Creating Custom Tags (help.adobe.com)

    Note: Although tag names in ColdFusion pages are not case sensitive, custom tag filenames must be lowercase on UNIX.

    cfinvoke Documentation (help.adobe.com)

    On UNIX systems, ColdFusion searches first for a file with a name that matches the specified component name, but is all lower case. If it does not find the file, it looks for a file name that matches the component name exactly, with the identical character casing.

    Since <cfinvoke> is a standard tag, the tag itself is case-insensitive. However, it sounds like all component argument(s) to <cfinvoke> need to have a lower-case filenames in order for calls with irregular casing to succeed consistently. I know you said refactoring is difficult, but this is what I've come up with:

    If you have a folder where you specifically keep components, it's trivial to run a shell script in that folder that renames them all to have lower-casing (remove -i if you don't want to be asked if you're sure each time):

    for filename in *.cfc; do
      lowercase =`echo $filename | tr '[:upper:]' '[:lower:]'`
      mv -i $filename $lowercase
    done
    

    If you don't have the components all in the same folder, try it from the top directory.

    Let me know if you were able to give this a shot!