ZF:在 application.ini 中禁用资源插件
如何在 cli 环境中禁用缓存?
原因是执行脚本的系统用户不允许写入缓存目录,因此脚本无法执行。
在我的 application.ini 中,我有
[production]
resources.cachemanager.database.frontend.name = Core
resources.cachemanager.database.frontend.customFrontendNaming = false
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization = true
resources.cachemanager.database.backend.name = File
resources.cachemanager.database.backend.customBackendNaming = false
resources.cachemanager.database.backend.options.cache_dir = HTTPDOCS_PATH "/data/cache/database"
resources.cachemanager.database.frontendBackendAutoload = false
[cli : production]
*<]:-)
How can I disable cache in the cli enviroment?
Reason being, the system user that executes the script is not allowed to write to the cache directory, thus the script is unable to execute.
In my application.ini I have
[production]
resources.cachemanager.database.frontend.name = Core
resources.cachemanager.database.frontend.customFrontendNaming = false
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization = true
resources.cachemanager.database.backend.name = File
resources.cachemanager.database.backend.customBackendNaming = false
resources.cachemanager.database.backend.options.cache_dir = HTTPDOCS_PATH "/data/cache/database"
resources.cachemanager.database.frontendBackendAutoload = false
[cli : production]
*<]:-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
查看 API 和 ZF 参考指南,适用于
Zend_Cache_Core$_options
属性代码>Try
See the API and the ZF Reference Guide for the
$_options
property inZend_Cache_Core
和您一样,我没有看到明显的方法来禁用在父部分中注册的配置部分中的插件。如果 Zend_Config_Ini 允许多重继承,就像 HTML 元素可以在 class 属性中使用多个 CSS 类一样,那就太酷了。 (是吗?我猜不是)。然后你可以将插件注册放入一个部分
[myplugsection]
,允许[生产]
扩展[myplug]
,而[cli ]
没有,有点像 Doctrine 的actAs
模板和行为。下一个最好的事情可能是创建一个名为 [core] 的部分,其中包含您现在在
[生产]
中拥有的大部分内容。[product]
和[cli]
都可以扩展[core]
,但[product]
会注册插件而[cli]
则不会。当然,另一种方法是将插件注册移动到 Bootstrap 中,您可以更好地控制插件注册。特别是,您可以调用
$front->unregisterPlugin()
,其中$front
是FrontController
。只是大声思考......
干杯!
Like you, I see no obvious way to disable a plugin in a config section that was registered in a parent section. It would be cool if
Zend_Config_Ini
allowed multiple inheritance, kind of like how an HTML element can multiple CSS classes in the class attribute. (Does it? I'm guessing not). Then you could put the plugin registration into one section[myplugsection]
, allow[production]
to extend[myplug]
while[cli]
does not, kind of like how Doctrine hasactAs
templates and beahviors.The next best thing might be to create a section called something like [core]containing most of what you now habe in
[production]
. Both[production]
and[cli]
could extend[core]
, but[production]
would register the plugin while[cli]
would not.Of course, an alternative would be to could move the plugin registration into Bootstrap where you have finer control of the plugin registration. In particular, you can call
$front->unregisterPlugin()
, where$front
is theFrontController
.Just thinking out loud...
Cheers!