ZF: Disable Resource Plugin in application.ini

徘徊边缘 提交于 2020-01-02 16:18:49

问题


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]

*<]:-)


回答1:


Try

resources.cachemanager.database.frontend.options.caching = false

See the API and the ZF Reference Guide for the $_options property in Zend_Cache_Core




回答2:


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 has actAs 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 the FrontController.

Just thinking out loud...

Cheers!



来源:https://stackoverflow.com/questions/4678334/zf-disable-resource-plugin-in-application-ini

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!