CFLib.org – Common Function Library Project

isColdFusionVersionAtleast(MinimumVersionNumber)

Last updated April 14, 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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson