CFLib.org – Common Function Library Project

isColdFusionVersionAtleast(MinimumVersionNumber)

Last updated April 15, 2011

author

Jon Hartmann

Version: 1 | Requires: CF9 | Library: CFMLLib

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:

<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:

<!---
 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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson