« Return to Thread: Zend_Loader_PluginLoader example code suggestion

Re: Zend_Loader_PluginLoader example code suggestion

by weierophinney :: Rate this Message:

Reply to Author | View in Thread

-- John Lamb <john@...> wrote
(on Thursday, 26 March 2009, 01:56 PM +0000):

> Is this the right place to suggest a change to Example 28.6 in the docs?
> <http://framework.zend.com/manual/en/zend.loader.pluginloader.html#zend.loader.pluginloader.performance.example>
>
> The code is currently:
> $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php';
> if (file_exists($classFileIncCache)) {
>     include_once $classFileIncCache;
> }
> Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
>
>
> But I believe the following would be better, as the file needs to both
> exist and be writable for the setIncludeFileCache line to work.
>
> $classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php';
> if (is_writable($classFileIncCache)) {
>     include_once $classFileIncCache;
>     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
> }

To include it, you only need to know that the file exists. The line to
setIncludeFileCache() can actually be omitted once you've populated the
cache well. I certainly wouldn't make is_writable() a requirement for
loading from it.

That said... I should probably put an is_writable() check into
_appendCache() and throw an exception if it's not.

--
Matthew Weier O'Phinney
Software Architect      | matthew@...
Zend Framework          | http://framework.zend.com/

 « Return to Thread: Zend_Loader_PluginLoader example code suggestion