<!--- Import the current tag library for the progress bar --->
<cfparam name="bImportDevtools" default="true">
<cfif bImportDevtools>
	<cfimport taglib="../../cfcustomtags/devtools" prefix="devtools">
</cfif>

<!-------- RUN ANY DETECTED PATCHES THAT ARE VALID -------->

<cfdirectory action="list" directory="#application.paths.sDrive#\Updates\scripts\" name="qryPatches" filter="patch_#sCurrentMajor#.*.cfm">
<cfset NUMBER_OF_PATCHES = qryPatches.RecordCount>
<devtools:progress_bar_subincrement reset="true" nSubNumIntervals="#NUMBER_OF_PATCHES - Int(nCurrentPatch)#"/>
<cfloop query="qryPatches">
	<cfset PatchVersion = Replace(Replace(qryPatches.name, "patch_", ""), ".cfm", "")>
	<cfset PatchNo = Int(ListLast(PatchVersion, "."))>
	<cfif nCurrentPatch LT PatchNo>
		<cfset form.UpdateVersion = "#sCurrentMajor#.#PatchNo#">
		<cfinclude template="#qryPatches.name#">
		<devtools:progress_bar_subincrement />
		<cfthread action="sleep" duration="500" />
	</cfif>
</cfloop>