Changeset 26405


Ignore:
Timestamp:
06/20/10 19:56:17 (7 years ago)
Author:
flack
Message:

cache loaded leaves per topic, refs #359

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/developers/flack/acltuning/midcom.core/midcom/helper/_basicnav.php

    r26404 r26405  
    625625        debug_push_class(__CLASS__, __FUNCTION__);
    626626
    627         if (in_array($node[MIDCOM_NAV_ID], $this->_loaded_leaves, true))
     627        if (array_key_exists($node[MIDCOM_NAV_ID], $this->_loaded_leaves))
    628628        {
    629629            debug_add("Warning, tried to load the leaves of node {$node[MIDCOM_NAV_ID]} more then once.", MIDCOM_LOG_INFO);
     
    631631            return;
    632632        }
     633
     634        $this->_loaded_leaves[$node[MIDCOM_NAV_ID]] = array();
    633635
    634636        debug_add("Loading leaves for node {$node[MIDCOM_NAV_ID]}");
     
    642644                $this->_leaves[$id] = $leaf;
    643645                $this->_guid_map[$leaf[MIDCOM_NAV_GUID]] =& $this->_leaves[$id];
    644             }
    645         }
    646         $this->_loaded_leaves[] = $node[MIDCOM_NAV_ID];
     646                $this->_loaded_leaves[$node[MIDCOM_NAV_ID]][$id] =& $this->_leaves[$id];
     647            }
     648        }
    647649
    648650        debug_pop();
     
    10761078        }
    10771079
    1078         if (!in_array($parent_node, $this->_loaded_leaves, true))
     1080        if (!array_key_exists($parent_node, $this->_loaded_leaves))
    10791081        {
    10801082            $this->_load_leaves(self::$_nodes[$parent_node]);
     
    10871089
    10881090        $result = array();
    1089         foreach ($this->_leaves as $id => $leaf)
    1090         {
    1091             if ($leaf[MIDCOM_NAV_NODEID] === $parent_node &&
    1092                 ($show_noentry || !$leaf[MIDCOM_NAV_NOENTRY]))
     1091        foreach ($this->_loaded_leaves[self::$_nodes[$parent_node][MIDCOM_NAV_ID]] as $id => $leaf)
     1092        {
     1093            if ($show_noentry || !$leaf[MIDCOM_NAV_NOENTRY])
    10931094            {
    10941095                $result[] = $id;
Note: See TracChangeset for help on using the changeset viewer.