Author: david
Date: Tue Nov 15 13:21:03 2011
New Revision: 10330

Log:
Make menu partial cache culturally sensitive.  Makes r10329 unnecessary 
(rollback). Fixes issue #2171.

Modified:
   trunk/apps/qubit/modules/menu/actions/editAction.class.php
   trunk/apps/qubit/templates/_header.php
   trunk/apps/qubit/templates/layout.php
   trunk/lib/myUser.class.php

Modified: trunk/apps/qubit/modules/menu/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/menu/actions/editAction.class.php  Tue Nov 15 
13:02:45 2011        (r10329)
+++ trunk/apps/qubit/modules/menu/actions/editAction.class.php  Tue Nov 15 
13:21:03 2011        (r10330)
@@ -152,8 +152,8 @@
         // Remove cache
         if ($this->context->getViewCacheManager() !== null)
         {
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key='.$this->context->getUser()->getCulture());
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key='.$this->context->getUser()->getCulture());
         }
 
         $this->redirect(array('module' => 'menu', 'action' => 'list'));

Modified: trunk/apps/qubit/templates/_header.php
==============================================================================
--- trunk/apps/qubit/templates/_header.php      Tue Nov 15 13:02:45 2011        
(r10329)
+++ trunk/apps/qubit/templates/_header.php      Tue Nov 15 13:21:03 2011        
(r10330)
@@ -35,4 +35,4 @@
 
 <?php echo get_component('search', 'box') ?>
 
-<?php echo get_component('menu', 'browseMenu', array('sf_cache_key' => 
'settings')) ?>
+<?php echo get_component('menu', 'browseMenu', array('sf_cache_key' => 
$sf_user->getCulture())) ?>

Modified: trunk/apps/qubit/templates/layout.php
==============================================================================
--- trunk/apps/qubit/templates/layout.php       Tue Nov 15 13:02:45 2011        
(r10329)
+++ trunk/apps/qubit/templates/layout.php       Tue Nov 15 13:21:03 2011        
(r10330)
@@ -22,7 +22,7 @@
         <?php if ($sf_user->isAuthenticated()): ?>
           <div id="navigation">
             <div class="section">
-              <?php echo get_component('menu', 'mainMenu', 
array('sf_cache_key' => 'settings')) ?>
+              <?php echo get_component('menu', 'mainMenu', 
array('sf_cache_key' => $sf_user->getCulture())) ?>
             </div> <!-- /.section -->
           </div> <!-- /#navigation -->
         <?php endif; ?>

Modified: trunk/lib/myUser.class.php
==============================================================================
--- trunk/lib/myUser.class.php  Tue Nov 15 13:02:45 2011        (r10329)
+++ trunk/lib/myUser.class.php  Tue Nov 15 13:21:03 2011        (r10330)
@@ -94,17 +94,6 @@
     $this->getAttributeHolder()->remove('nav_context_module');
   }
 
-  public function setCulture($culture)
-  {
-    parent::setCulture($culture);
-
-    // Clear menu cache
-    $cacheDir = 
sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.'qubit'.DIRECTORY_SEPARATOR.sfConfig::get('sf_environment').DIRECTORY_SEPARATOR.'template';
-    $cache = new sfFileCache(array('cache_dir' => $cacheDir));
-    $cache->removePattern('*/__browseMenu/sf_cache_key/**');
-    $cache->removePattern('*/__mainMenu/sf_cache_key/**');
-  }
-
   public function getUserID()
   {
     return $this->getAttribute('user_id');

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.

Reply via email to