public function executeRemove($request) { $this->patterns = array(); if ($request->isMethod('post')) { sfContext::switchTo('frontend'); $frontendContext = sfContext::getInstance(); if ($page = $request->getParameter('page')) { $routing = $frontendContext->getRouting(); if ($route = $routing->findRoute($page)) { $params = $route['parameters']; $module = $params['module']; $action = $params['action']; unset($params['module']); unset($params['action']); unset($params['sf_culture']); $this->patterns = LsCache::generateCachePatterns($module, $action, $params); LsCache::clearCachePatterns($this->patterns); } } if ($entityId = $request->getParameter('entity_id')) { $this->patterns = array_merge($this->patterns, LsCache::clearEntityCacheById($entityId)); } if ($relationshipId = $request->getParameter('relationship_id')) { $this->patterns = array_merge($this->patterns, LsCache::clearRelationshipCacheById($relationshipId)); } if ($listId = $request->getParameter('list_id')) { $this->patterns = array_merge($this->patterns, LsCache::clearListCacheById($listId)); } if ($userName = $request->getParameter('username')) { $this->patterns = array_merge($this->patterns, LsCache::clearUserCacheByName($userName)); } if ($groupName = $request->getParameter('groupname')) { $this->patterns = array_merge($this->patterns, LsCache::clearGroupCacheByName($groupName)); } sfContext::switchTo('backend'); } }
public function executeMakePrimaryAlias($request) { if (!$request->isMethod('post')) { $this->forward('error', 'invalid'); } $alias = Doctrine::getTable('Alias')->find($request->getParameter('id')); $this->forward404Unless($alias); $alias->makePrimary(); //comprehensive cache clearing due to changed primary alias $this->clearCache($alias->Entity); $entity_relationships = $alias->Entity->getEntitiesWithRelationships(); $patterns = array(); foreach ($entity_relationships as $order => $categoryIds) { foreach ($categoryIds as $categoryId => $entityIds) { foreach ($entityIds as $entityId => $entityAry) { $patterns = array_merge($patterns, LsCache::getEntityCachePatternsById($entityId)); foreach ($entityAry['rels'] as $rel) { $patterns = array_merge($patterns, LsCache::getRelationshipCachePatternsById($rel['id'])); } } } } LsCache::clearCachePatterns($patterns); $this->redirect($alias->Entity->getInternalUrl('editAliases')); }