ZF-7058: Zend_Application Locale Resource - set cache via config
Description
It would be nice to have posibility to set zend locale cache via application.ini config file
It would be nice to have posibility to set zend locale cache via application.ini config file
Comments
Posted by Cristian Bichis (avantis) on 2009-07-19T09:33:16.000+0000
I think this already works...
resources.locale.default = en_US
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-09-18T11:18:45.000+0000
Could you please elaborate your request? I'm not sure I follow.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-09-25T08:53:17.000+0000
Closing as 'incomplete' as for it's unclear (read: real vague) what is asked for here.
Posted by Pawel Szczekutowicz (fenoms) on 2011-02-03T06:22:59.000+0000
I think this was about ability to add in config file (application.ini) something like this:
resources.locale.cache = ""locale"
and this cache named "locale" can be defined by/in cachemanager also using config file (application.ini)
resources.cachemanager.locale.frontend.name = Core etc...
Posted by Pawel Szczekutowicz (fenoms) on 2011-02-03T08:43:00.000+0000
This patch should give the desired functionality
*** library/Zend/Application/Resource/Locale.php 2010-02-01 21:13:08.000000000 +0100 --- library/Zend/Application/Resource/Locale.php 2011-02-03 15:33:05.375000092 +0100
*** 86,89 **** --- 86,121 ----
+
+ /** + * Set the locale cache + * + * @param string|Zend_Cache_Core $cache + * @return Zend_Application_Resource_Locale + */ + public function setCache($cache) + { + $localeCache = null; + + if (is_string($cache)) { + $bootstrap = $this->getBootstrap(); + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper + && $bootstrap->hasPluginResource('CacheManager') + ) { + $cacheManager = $bootstrap->bootstrap('CacheManager') + ->getResource('CacheManager'); + if (null !== $cacheManager && $cacheManager->hasCache($cache)) { + $localeCache = $cacheManager->getCache($cache); + } + } + } else if ($cache instanceof Zend_Cache_Core) { + $localeCache = $cache; + } + + if ($localeCache instanceof Zend_Cache_Core) { + Zend_Locale::setCache($localeCache); + } + + return $this; + }
}
Posted by Sergio Vaccaro (hujuice) on 2011-02-03T10:00:14.000+0000
See the alternative proposed at 10720. The way that I suggested (not as patch for laziness) gives the opportunity to use a more generally available cache:
I think that a 'merge' between the two solutions should be used.
Regards, Sergio
Posted by Benoît Durand (intiilapa) on 2011-02-03T11:12:31.000+0000
@Pawe? Szczekutowicz, we can not use a patch if you have not signed CLA.
I will follow the code I made for other resources (#ZF-10033, #ZF-10034, and #ZF-10049). I forgot that Zend_Locale also had a cache too.
Posted by Benoît Durand (intiilapa) on 2011-02-19T23:24:32.000+0000
Fixed in r23747.
Posted by Matthew Weier O'Phinney (matthew) on 2011-03-02T07:54:11.000+0000
Including in 1.11.4 release.