CFLib.org – Common Function Library Project

isColdFusionVersionAtleast(MinimumVersionNumber)

Last updated April 14, 2011

Version: 1 | Requires: ColdFusion 9 | Library: CFMLLib

 
Rated 0 time(s). Average Rating: 0

Description:
Accepts a comma delimited version number and checks it against the current Server.ColdFusion.ProductVersion value. It returns true if the current product version is at least the given value, and false if not.

Return Values:
Returns a boolean.

Example:

view plain print about
<cfif NOT IsColdFusionVersionAtleast("9,0,1")>
    This application requires atleast ColdFusion version 9.0.1. Please update your server.
    <cfabort />
</cfif>

Parameters:

Name Description Required
MinimumVersionNumber Minimum ColdFusion version Yes

Full UDF Source:

view plain print about
<!---
 Checks the server's ColdFusion product version
 
 @param MinimumVersionNumber      Minimum ColdFusion version (Required)
 @return Returns a boolean. 
 @author Jon Hartmann (jon.hartmann@gmail.com) 
 @version 1, April 14, 2011 
--->

<cffunction name="isColdFusionVersionAtleast" access="private" output="false" returntype="boolean">
    <cfargument name="MinimumVersionNumber" type="string" required="true" />

    <cfset Local.VersionData = ListToArray(Server.ColdFusion.ProductVersion) />
    <cfset Local.TestVersionData = ListToArray(Arguments.MinimumVersionNumber) />
    <cfset Local.Result = true />
    <cfset local.x = "">
    
    <cfloop from="1" to="#Min(ArrayLen(Local.TestVersionData), ArrayLen(Local.VersionData))#" index="x">
        <cfif Local.VersionData[x] lt Local.TestVersionData[x]>
            <cfset Local.Result = false />
            <cfbreak />
        <cfelseif Local.VersionData[x] gt Local.TestVersionData[x]>
            <cfbreak />
        </cfif>
    </cfloop>

    <cfreturn Local.Result />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson