Skip to content

Commit b69e40a

Browse files
committed
attempting to fix lucee 6 compat by checking for existence of queryToStruct function
1 parent acc4269 commit b69e40a

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

core/api.cfc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<cfset var before = getTickCount() />
6464
<cfset var after = 0 />
6565
<cfset setupFramework() />
66+
<cfset checkEngineSupport() />
6667
<cfset after = getTickCount() />
6768
<cfheader name="X-TIME-TO-RELOAD" value="#(after-before)#" />
6869
<cfreturn true />
@@ -587,6 +588,22 @@
587588
<!--- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --->
588589

589590
<!--- internal methods --->
591+
<cffunction name="checkEngineSupport" access="private" output="false" returntype="void">
592+
<cfscript>
593+
application._taffy.compat = {
594+
queryToStruct: "missing",
595+
queryToArray: "missing"
596+
};
597+
var funcs = getFunctionList();
598+
if (structKeyExists(funcs, "queryToStruct")) {
599+
application._taffy.compat.queryToStruct = "exists";
600+
}
601+
if (structKeyExists(funcs, "queryToArray")) {
602+
application._taffy.compat.queryToArray = "exists";
603+
}
604+
</cfscript>
605+
</cffunction>
606+
590607
<cffunction name="setupFramework" access="private" output="false" returntype="void">
591608
<cfset var local = structNew() />
592609
<cfparam name="variables.framework" default="#structNew()#" />

core/resource.cfc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<cfset logger.saveLog(exception) />
5151
</cffunction>
5252

53-
<cffunction name="queryToArray" access="private" returntype="array" output="false">
53+
<cffunction name="qToArray" access="private" returntype="array" output="false">
5454
<cfargument name="q" type="query" required="yes" />
5555
<cfargument name="cb" type="any" required="no" />
5656
<cfscript>
@@ -80,7 +80,15 @@
8080
</cfscript>
8181
</cffunction>
8282

83-
<cffunction name="queryToStruct" access="private" returntype="struct" output="false">
83+
<cfif application._taffy.compat.queryToArray eq "missing">
84+
<cffunction name="queryToArray" access="private" returntype="struct" output="false">
85+
<cfargument name="q" type="query" required="yes" />
86+
<cfargument name="cb" type="any" required="no" />
87+
<cfreturn qToArray(arguments.q, arguments.cb) />
88+
</cffunction>
89+
</cfif>
90+
91+
<cffunction name="qToStruct" access="private" returntype="struct" output="false">
8492
<cfargument name="q" type="query" required="yes" />
8593
<cfargument name="cb" type="any" required="no" />
8694
<cfset var local = {} />
@@ -115,6 +123,14 @@
115123
</cfscript>
116124
</cffunction>
117125

126+
<cfif application._taffy.compat.queryToStruct eq "missing">
127+
<cffunction name="queryToStruct" access="private" returntype="struct" output="false">
128+
<cfargument name="q" type="query" required="yes" />
129+
<cfargument name="cb" type="any" required="no" />
130+
<cfreturn qToStruct(arguments.q, arguments.cb) />
131+
</cffunction>
132+
</cfif>
133+
118134
<!---
119135
function that gets the representation class instance
120136
-- if the argument is blank, we use the default from taffy settings
@@ -132,7 +148,7 @@
132148
<cfreturn createObject("component", arguments.repClass) />
133149
</cfif>
134150
</cffunction>
135-
151+
136152
<cffunction name="addDebugData" access="package" output="false">
137153
<cfargument name="data" type="any" />
138154
<cfset request.debugData = arguments.data />

0 commit comments

Comments
 (0)