Today I found a small bug in Mach-II 1.0.10 plugin execution order. One of the new features in 1.0.10 was that plugins would execute in the order defined. However, the configure method in plugins are still executed in random order.
I posted this to the Mach-II forums on fusebox.org and it was later confirmed by Sean Corfield. It is assumed that this will be addressed in a future release. Till then here’s how to fix the bug.
In your MachII/framework folder there is a file PluginManager.cfc. This file’s configure method is the culprit. In version 1.0.10 it reads as follows:
<cffunction access="public" name="configure" returntype="void"> <cfset key=0 var/> <cfloop collection="#variables.plugins#" item="key"> <cfset getPlugin(key).configure()/> </cfloop> </cffunction>
According to Sean Corfield, this should read like this:
<cffunction access="public" name="configure" output="false" returntype="void"> <cfset aPlugin=0 var/> <cfset i=0 var/> <cfloop from="1" index="i" to="#variables.nPlugins#"> <cfset aPlugin=variables.pluginArray[i]/> <cfset aPlugin.configure()/> </cfloop> </cffunction>
I would assume that making this change would be safe to make as future versions of Mach-II would probably implement the exact same functionality.