/** * Clears the view cache for a subtree * * @param eZContentObjectTreeNodeNoLanguage $node * @param bool $clearForRootNode * @return bool */ static function clearViewCacheForSubtree(eZContentObjectTreeNodeNoLanguage $node, $clearForRootNode = true) { // Max nodes to fetch at a time static $limit = 200; if ($clearForRootNode) { $objectID = $node->attribute('contentobject_id'); eZContentCacheManager::clearContentCacheIfNeeded($objectID); } $offset = 0; $params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array()); // Empty array means no permission checking $subtreeCount = $node->subTreeCount($params); while ($offset < $subtreeCount) { $params['Offset'] = $offset; $params['Limit'] = $limit; $subtreeChunk = $node->subTree($params); $nNodesInChunk = count($subtreeChunk); $offset += $nNodesInChunk; if ($nNodesInChunk == 0) { break; } $objectIDList = array(); foreach ($subtreeChunk as $curNode) { $objectIDList[] = $curNode['id']; } unset($subtreeChunk); eZContentCacheManager::clearContentCacheIfNeeded(array_unique($objectIDList)); } return true; }