Fusebox 不解析 xml 文件

发布于 2024-11-06 06:09:07 字数 1507 浏览 5 评论 0原文

目前,在 application.cfc 中,我扩展了 Fusebox 5.5 框架。 然后在下面的 OnRequestStart 方法中,我根据特定条件设置保险丝盒模式。

问题是,有时,无论我进行什么更改,fusebox xml 文件都不会重新解析。如果我使用 url 变量fusebox.parse=true&fusebox.loadclean=true&fusebox.password=xxx 强制重新解析,则文件会再次解析。

几乎就像 Fusebox 仍处于生产模式一样,即使当我转储 FUSEBOX_PARAMETERS.mode 时它显示“development-full-load”,

这可能是什么原因造成的?在下面的代码中,fusebox 模式的操作方式是否正确,还是应该在其他地方进行这种设置(显然除了fusebox.xml 之外)?

任何帮助都会很棒。 谢谢

 <cffunction name="onRequestStart">
    <cfset variables.server_type = "Development" />

    <cfswitch expression="#variables.server_type#">
        <cfcase value="development">
            <cfset FUSEBOX_PARAMETERS.mode = "development-circuit-load" />
            <cfset FUSEBOX_PARAMETERS.debug = true />
            <cfset request.component_reload = true />
        </cfcase>
        <cfdefaultcase>
            <cfset FUSEBOX_PARAMETERS.mode = "production" />
            <cfset FUSEBOX_PARAMETERS.debug = false />
            <cfset request.component_reload = false />
        </cfdefaultcase>
    </cfswitch>
    <cfif (StructKeyExists(attributes, "fusebox.loadapp") AND attributes.fusebox.password EQ application.fusebox.password) OR FUSEBOX_PARAMETERS.mode NEQ application.fusebox.mode>
        <cfset this.onApplicationStart() />
    </cfif> 

    <cfset superReturn = super.onRequestStart(arguments.1) />
</cffunction>

Currently, in the application.cfc, I extend the Fusebox 5.5 Framework.
Then in the OnRequestStart method below, I set the fusebox mode depending on a certain condition.

The problem is that sometimes, the fusebox xml files do not reparse no matter what changes I make. If I force a reparse using the url variables fusebox.parse=true&fusebox.loadclean=true&fusebox.password=xxx then the files parse again.

It is almost like Fusebox remains in production mode even though when I dump the FUSEBOX_PARAMETERS.mode it says "development-full-load"

What could be causing this? Is the way that the fusebox mode is being manipulated correct in the code below or should that kind of setting be done somewhere else (besides the fusebox.xml obviously)??

Any help would be great.
Thanks

 <cffunction name="onRequestStart">
    <cfset variables.server_type = "Development" />

    <cfswitch expression="#variables.server_type#">
        <cfcase value="development">
            <cfset FUSEBOX_PARAMETERS.mode = "development-circuit-load" />
            <cfset FUSEBOX_PARAMETERS.debug = true />
            <cfset request.component_reload = true />
        </cfcase>
        <cfdefaultcase>
            <cfset FUSEBOX_PARAMETERS.mode = "production" />
            <cfset FUSEBOX_PARAMETERS.debug = false />
            <cfset request.component_reload = false />
        </cfdefaultcase>
    </cfswitch>
    <cfif (StructKeyExists(attributes, "fusebox.loadapp") AND attributes.fusebox.password EQ application.fusebox.password) OR FUSEBOX_PARAMETERS.mode NEQ application.fusebox.mode>
        <cfset this.onApplicationStart() />
    </cfif> 

    <cfset superReturn = super.onRequestStart(arguments.1) />
</cffunction>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱殇璃 2024-11-13 06:09:07

请参阅,FUSEBOX_PARAMETERS 存储在 application 范围内,默认情况下它们包含在巨大的容器 application.fusebox 中。 Fusebox 设置是在调用 super.onApplicationStart() 时填充的,因此在 onRequestStart 中修改它们没有意义。

我建议将 cfswitch 代码移至定义应用程序设置的组件主体中。

onRequestStart 中,您可以强制应用程序重新启动以重新读取设置,可能是这样的:

<cfif StructKeyExists(attributes, "fusebox.loadapp") AND attributes["fusebox.password"] EQ application.fusebox.password>
    <cfset this.onApplicationStart() /
</cfif>

请注意,fusebox.loadapp 不是内置的 Fusebox 属性,它只能工作对于您的应用程序,为了方便起见,只需像其他应用程序一样添加前缀即可。这样您就可以重新读取应用程序的单调。

See, FUSEBOX_PARAMETERS are stored in application scope, by default they are included in huge container application.fusebox. Fusebox settings are populated when super.onApplicationStart() invoked, so modifying them in onRequestStart does not make sense.

I would recommend to move your cfswitch code into the component body where you define application settings.

In onRequestStart you can force the application restart to reread the settings, possibly something like this:

<cfif StructKeyExists(attributes, "fusebox.loadapp") AND attributes["fusebox.password"] EQ application.fusebox.password>
    <cfset this.onApplicationStart() /
</cfif>

Please note that fusebox.loadapp is not built-in Fusebox attribute, it will work only for your app, simply prefixed like others for convenience. This way you can reread the singletones of your application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文