Author: Jonathan.Wage
Date: 2010-01-17 21:46:39 +0100 (Sun, 17 Jan 2010)
New Revision: 26782
Modified:
plugins/sfSympalPlugin/trunk/lib/core/sfSympalConfiguration.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
Log:
[1.4][sfSympalPlugin][1.0] Fix for menu caching and disabling symfony autoload
again feature
Modified: plugins/sfSympalPlugin/trunk/lib/core/sfSympalConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/core/sfSympalConfiguration.class.php
2010-01-17 20:43:49 UTC (rev 26781)
+++ plugins/sfSympalPlugin/trunk/lib/core/sfSympalConfiguration.class.php
2010-01-17 20:46:39 UTC (rev 26782)
@@ -15,6 +15,11 @@
public function __construct(sfEventDispatcher $dispatcher,
ProjectConfiguration $projectConfiguration)
{
+ // We disable Symfony autoload again feature because it is too slow in dev
mode
+ // If you introduce a new class when using sympal you just must clear your
+ // cache manually
+ sfAutoloadAgain::getInstance()->unregister();
+
$this->_dispatcher = $dispatcher;
$this->_projectConfiguration = $projectConfiguration;
$this->_doctrineManager = Doctrine_Manager::getInstance();
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
2010-01-17 20:43:49 UTC (rev 26781)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
2010-01-17 20:46:39 UTC (rev 26782)
@@ -49,6 +49,11 @@
return self::getInstance()->_getMenu($name, $showChildren, $class);
}
+ protected function _getCache()
+ {
+ return sfSympalConfig::get('menu_cache', 'enabled', true) ?
sfSympalConfiguration::getActive()->getCache() : false;
+ }
+
protected function _getMenu($name, $showChildren = null, $class = null)
{
if (!$name)
@@ -62,45 +67,27 @@
return $this->_menus[$cacheKey];
}
- if ($menuCacheEnabled = sfSympalConfig::get('menu_cache', 'enabled', true))
+ $cache = $this->_getCache();
+ if ($cache && $cache->has($cacheKey))
{
- $cache = sfSympalConfiguration::getActive()->getCache();
- if ($cache->has($cacheKey))
+ $menu = $cache->get($cacheKey);
+ } else {
+ $this->initialize();
+ $menu = $this->_buildMenu($name, $class);
+ if ($cache)
{
- $menu = $cache->get($cacheKey);
- $this->_menus[$cacheKey] = $menu;
-
- if ($showChildren !== null)
- {
- $menu->callRecursively('showChildren', $showChildren);
- }
-
- return $menu;
+ $cache->set($cacheKey, $menu);
}
}
- $this->initialize();
+ $this->_menus[$cacheKey] = $menu;
- $menu = $this->_buildMenu($name, $class);
-
- if ($menu)
+ if ($showChildren !== null && $menu)
{
- if ($showChildren !== null)
- {
- $menu->callRecursively('showChildren', $showChildren);
- }
-
- $this->_menus[$cacheKey] = $menu;
-
- if ($menuCacheEnabled)
- {
- $cache->set($cacheKey, $menu);
- }
-
- return $menu;
- } else {
- return false;
+ $menu->callRecursively('showChildren', $showChildren);
}
+
+ return $menu;
}
protected function _buildMenu($name, $class)
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.