简体   繁体   中英

ZF: Disable Resource Plugin in application.ini

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]

*<]:-)

Try

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

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM