Specifications
28 Migrating ColdFusion 5 Applications
Tag and function examples
This section provides remedies for some of the compatibility issues listed in “CFML tags
and attributes” on page 7 and “CFML functions and variables” on page 13.
Note: For the most current information on ColdFusion MX compatibility, see the Support
section of the Macromedia website (http://www.macromedia.com/support).
Using cfregistry in ColdFusion MX
The cfregistry tag is deprecated for UNIX and Linux platforms. Therefore, you must
remove it on UNIX-based versions of ColdFusion to avoid compatibility problems when
migrating to a later version of ColdFusion MX.
As an alternative, you can use the store variables in the following scopes:
• Client
• Text file
• Encoded text file
• Database
• LDAP server
In Windows, you can continue to store client variables in the registry as in ColdFusion 5.
However, you should not use the
cfregistry tag to read ColdFusion server settings
from the registry, such as the mail root and information about Verity collections and
scheduled tasks, because much of this information is no longer stored in the registry, or it
is in a different location in the registry. The ColdFusion server settings that are stored in
the registry are subject to change. Therefore, you should not rely on registry keys that
ColdFusion creates to store its system settings.
Following are two common examples of using the
cfregistry tag in ColdFusion 5 that
are not compatible with ColdFusion MX.
Incompatible example
In ColdFusion 5, the following sample code checks if a Verity collection exists, and if
not, creates one in the appropriate directory relative to the installation path. In
ColdFusion MX, this sample code throws an error, because ColdFusion MX does not
store information about Verity collections and the installation directory in the registry.
<CFREGISTRY ACTION = "GETALL"
Branch = "HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\
Collections"
Type = "KEY"
Name = "Collections">
<CFSET CollectionFound = 'No'>
<CFLOOP QUERY = "Collections">
<CFIF Collections.Entry IS request.datasource>
<CFSET CollectionFound = 'Yes'>
</CFIF>
</CFLOOP>
<CFIF CollectionFound IS 'No'>
<!--- Create the collection --->
<CFREGISTRY ACTION = "GET"