Esempio n. 1
0
 private static function _getIndirectChildComponentClasses($class, $select, $cacheId)
 {
     static $ccc = array();
     $currentCacheId = 'iccc-' . md5($class . $cacheId);
     if (isset($ccc[$class . $cacheId])) {
         Kwf_Benchmark::count('iccc cache hit');
         return $ccc[$class . $cacheId];
     }
     $ret = Kwf_Cache_SimpleStatic::fetch($currentCacheId, $success);
     if ($success) {
         $ccc[$class . $cacheId] = $ret;
         Kwf_Benchmark::count('iccc cache semi-hit');
         return $ret;
     }
     Kwf_Benchmark::count('iccc cache miss', $class . ' ' . print_r($select->getParts(), true));
     $childConstraints = array('page' => false);
     $ccc[$class . $cacheId] = array();
     foreach (Kwc_Abstract::getChildComponentClasses($class, $childConstraints) as $childClass) {
         if (Kwc_Abstract::getChildComponentClasses($childClass, $select, $cacheId)) {
             $ccc[$class . $cacheId][] = $childClass;
             continue;
         }
         $classes = Kwc_Abstract::_getIndirectChildComponentClasses($childClass, $select, $cacheId);
         if ($classes) {
             $ccc[$class . $cacheId][] = $childClass;
         }
     }
     $ccc[$class . $cacheId] = array_unique(array_values($ccc[$class . $cacheId]));
     Kwf_Cache_SimpleStatic::add($currentCacheId, $ccc[$class . $cacheId]);
     return $ccc[$class . $cacheId];
 }