Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Deprecated code and features are those that have been retired and replaced by alternative functionality. These features should not be used, and remain in the code base for the sole purpose of providing backward compatibility. You can assume that at some point this code will be removed, so developers should make every effort to refactor code relying on deprecated elements of the framework.

Deprecated Logging

In an effort to make detecting the use of deprecated code easier, we have tried to integrate an option for logging the use of deprecated features. Where possible we log the use of a deprecated feature and suggest an alternative.

You can turn on logging by setting a flag for application.log.bDeprecated in your project's ./config/_serverSpecificVars.cfm

./config/_serverSpecificVars.cfm
<cfset application.log.bDeprecated = true />

As you use your application a log called deprecated.log will be generated in your servers logging directory. You can reach this through the CFIDE administrator logging area. In addition, a trace will be made at runtime into your debugging output; you will need to activate view CFTRACE in your debugging to see this.

Flagging Code As Deprecated

Inline Code

As a core developer you can flag deprecated code by including this following snippet:

Example Deprecated Code Snippet
<!--- @@deprecated: ../admin/navajo/edit.cfm should be replaced by call to ../conjuror/invocation.cfm --->
<cfimport taglib="/farcry/core/tags/farcry" prefix="farcry" />
<farcry:deprecated msg="../admin/navajo/edit.cfm should be replaced by call to ../conjuror/invocation.cfm" />

The log message should specify what deprecated feature is being used and the alternative feature/function that should be used in its stead.

Innards

./tags/farcry/deprecated.cfm
<cfif structkeyExists(application.log, "bDeprecated") AND application.log.bDeprecated>
	<cfset deprecatedMsg="../admin/navajo/edit.cfm should be replaced by call to ../conjuror/invocation.cfm" />
	<cftrace type="warning" inline="false" text="#deprecatedMsg#" abort="false" />
	<cflog file="deprecated" application="true" type="warning" text="#deprecatedMsg#" />
</cfif>
  • No labels