static function nodeListForObject($contentObject, $versionNum, $clearCacheType, &$nodeList, &$handledObjectList) { $contentObjectID = $contentObject->attribute('id'); if (isset($handledObjectList[$contentObjectID])) { $handledObjectList[$contentObjectID] |= $clearCacheType; } else { $handledObjectList[$contentObjectID] = $clearCacheType; } //self::writeDebugBits( $handledObjectList, self::CLEAR_SIBLINGS_CACHE ); $assignedNodes = $contentObject->assignedNodes(); // determine if $contentObject has dependent objects for which cache should be cleared too. $objectClassIdentifier = $contentObject->attribute('class_identifier'); $dependentClassInfo = eZContentCacheManager::dependencyInfo($objectClassIdentifier); if ($dependentClassInfo['clear_cache_type'] === self::CLEAR_NO_CACHE) { // BC: Allow smart cache clear setting to specify no caching setting $clearCacheType = self::CLEAR_NO_CACHE; } else { if ($dependentClassInfo['clear_cache_exclusive'] === true) { // use class specific smart cache rules exclusivly $clearCacheType = $dependentClassInfo['clear_cache_type']; } } if ($clearCacheType === self::CLEAR_NO_CACHE) { // when recursing we will never have to handle this object again for other cache types // because types of caches to clear will always be set to none $handledObjectList[$contentObjectID] = self::CLEAR_ALL_CACHE; } if ($clearCacheType & self::CLEAR_NODE_CACHE) { eZContentCacheManager::appendNodeIDs($assignedNodes, $nodeList); } if ($clearCacheType & self::CLEAR_PARENT_CACHE) { eZContentCacheManager::appendParentNodeIDs($contentObject, $versionNum, $nodeList); } if ($clearCacheType & self::CLEAR_RELATING_CACHE) { eZContentCacheManager::appendRelatingNodeIDs($contentObject, $nodeList); } if ($clearCacheType & self::CLEAR_KEYWORD_CACHE) { $keywordClearLimit = null; $viewcacheini = eZINI::instance('viewcache.ini'); if (is_numeric($viewcacheini->variable('ViewCacheSettings', 'KeywordNodesCacheClearLimit'))) { $keywordClearLimit = (int) $viewcacheini->variable('ViewCacheSettings', 'KeywordNodesCacheClearLimit'); } eZContentCacheManager::appendKeywordNodeIDs($contentObject, $versionNum, $nodeList, $keywordClearLimit); } if ($clearCacheType & self::CLEAR_SIBLINGS_CACHE) { eZContentCacheManager::appendSiblingsNodeIDs($assignedNodes, $nodeList); } if ($dependentClassInfo['clear_cache_type'] & self::CLEAR_SIBLINGS_CACHE) { if (!($clearCacheType & self::CLEAR_SIBLINGS_CACHE)) { eZContentCacheManager::appendSiblingsNodeIDs($assignedNodes, $nodeList); $handledObjectList[$contentObjectID] |= self::CLEAR_SIBLINGS_CACHE; } // drop 'siblings' bit and process parent nodes. // since 'sibling' mode is affected to the current object $dependentClassInfo['clear_cache_type'] &= ~self::CLEAR_SIBLINGS_CACHE; } if ($clearCacheType & self::CLEAR_CHILDREN_CACHE) { eZContentCacheManager::appendChildrenNodeIDs($assignedNodes, $nodeList); } if ($dependentClassInfo['clear_cache_type'] & self::CLEAR_CHILDREN_CACHE) { if (!($clearCacheType & self::CLEAR_CHILDREN_CACHE)) { eZContentCacheManager::appendChildrenNodeIDs($assignedNodes, $nodeList); $handledObjectList[$contentObjectID] |= self::CLEAR_CHILDREN_CACHE; } // drop 'children' bit and process parent nodes. // since 'children' mode is affected to the current object $dependentClassInfo['clear_cache_type'] &= ~self::CLEAR_CHILDREN_CACHE; } if (isset($dependentClassInfo['additional_objects'])) { foreach ($dependentClassInfo['additional_objects'] as $objectID) { // skip if cache type is already handled for this object if (isset($handledObjectList[$objectID]) && $handledObjectList[$objectID] & self::CLEAR_NODE_CACHE) { continue; } $object = eZContentObject::fetch($objectID); if ($object) { //eZDebug::writeDebug( 'adding additional object ' . $objectID, 'eZContentCacheManager::nodeListForObject() for object ' . $contentObjectID ); eZContentCacheManager::nodeListForObject($object, true, self::CLEAR_NODE_CACHE, $nodeList, $handledObjectList); } } } if (isset($dependentClassInfo['dependent_class_identifier'])) { $maxParents = $dependentClassInfo['max_parents']; $dependentClassIdentifiers = $dependentClassInfo['dependent_class_identifier']; $smartClearType = $dependentClassInfo['clear_cache_type']; // getting 'path_string's for all locations. $nodePathList = eZContentCacheManager::fetchNodePathString($assignedNodes); foreach ($nodePathList as $nodePath) { $step = 0; // getting class identifier and node ID for each node in the $nodePath, up to $maxParents $nodeInfoList = eZContentObjectTreeNode::fetchClassIdentifierListByPathString($nodePath, false, $maxParents); // for each node in $nodeInfoList determine if this node belongs to $dependentClassIdentifiers. If // so then clear cache for this node. foreach ($nodeInfoList as $item) { if (in_array($item['class_identifier'], $dependentClassIdentifiers)) { $object = eZContentObject::fetchByNodeID($item['node_id']); if (!$object instanceof eZContentObject) { continue; } $objectID = $object->attribute('id'); if (isset($handledObjectList[$objectID])) { // remove cache types that were already handled $smartClearType &= ~$handledObjectList[$objectID]; // if there are no cache types remaining, then skip if ($smartClearType == self::CLEAR_NO_CACHE) { continue; } } if (count($dependentClassInfo['object_filter']) > 0) { if (in_array($objectID, $dependentClassInfo['object_filter'])) { //eZDebug::writeDebug( 'adding parent ' . $objectID, 'eZContentCacheManager::nodeListForObject() for object ' . $contentObjectID ); eZContentCacheManager::nodeListForObject($object, true, $smartClearType, $nodeList, $handledObjectList); } } else { //eZDebug::writeDebug( 'adding parent ' . $objectID, 'eZContentCacheManager::nodeListForObject() for object ' . $contentObjectID ); eZContentCacheManager::nodeListForObject($object, true, $smartClearType, $nodeList, $handledObjectList); } } } } } //self::writeDebugBits( $handledObjectList, self::CLEAR_SIBLINGS_CACHE ); }