public function realiseAllSources($node, $sourceTo = null, &$addTo = null)
    {
        if (!$addTo) {
            $addTo = array();
        }
        
        $myIdent = $this->idStr($node);
        
        // if needbe, update the source map
        if ($sourceTo) {
            $sourceMap = $this->getCache()->load(self::SOURCES_MAP);
            if (!$sourceMap) {
                $sourceMap = array();
            }

            $myTree = isset($sourceMap[$myIdent]) ? $sourceMap[$myIdent] : array();
        
            $myTree[$sourceTo] = 1;
            $sourceMap[$myIdent] = $myTree;
            $this->getCache()->save($sourceMap, self::SOURCES_MAP);
        }

        $parents = $this->getEffectiveParents($node);
        if ($parents) {
            foreach ($parents as $parent) {
                $addTo[] = "{$parent->ClassName},$parent->ID";
                $this->realiseAllSources($parent, $myIdent, $addTo);
            }
        }
        
        $key = "sources_$myIdent";
        $this->getCache()->save($addTo, $key);
        
        return $addTo;
    }
public function realiseAllSources($node, $sourceTo = null, &$addTo = null)
    {
        if (!$addTo) {
            $addTo = array();
        }
        
        $myIdent = $this->idStr($node);
        
        // if needbe, update the source map
        if ($sourceTo) {
            $sourceMap = $this->getCache()->load(self::SOURCES_MAP);
            if (!$sourceMap) {
                $sourceMap = array();
            }

            $myTree = isset($sourceMap[$myIdent]) ? $sourceMap[$myIdent] : array();
        
            $myTree[$sourceTo] = 1;
            $sourceMap[$myIdent] = $myTree;
            $this->getCache()->save($sourceMap, self::SOURCES_MAP);
        }

        $parents = $this->getEffectiveParents($node);
        if ($parents) {
            foreach ($parents as $parent) {
                $addTo[] = "{$parent->ClassName},$parent->ID";
                $this->realiseAllSources($parent, $myIdent, $addTo);
            }
        }
        
        $key = "sources_$myIdent";
        $this->getCache()->save($addTo, $key);
        
        return $addTo;
    }
public function realiseAllSources ( $ node , $ sourceTo = null , & $ addTo = null ) { if ( ! $ addTo ) { $ addTo = array ( ) ; } $ myIdent = $ this -> idStr ( $ node ) ; // if needbe, update the source map if ( $ sourceTo ) { $ sourceMap = $ this -> getCache ( ) -> load ( self :: SOURCES_MAP ) ; if ( ! $ sourceMap ) { $ sourceMap = array ( ) ; } $ myTree = isset ( $ sourceMap [ $ myIdent ] ) ? $ sourceMap [ $ myIdent ] : array ( ) ; $ myTree [ $ sourceTo ] = 1 ; $ sourceMap [ $ myIdent ] = $ myTree ; $ this -> getCache ( ) -> save ( $ sourceMap , self :: SOURCES_MAP ) ; } $ parents = $ this -> getEffectiveParents ( $ node ) ; if ( $ parents ) { foreach ( $ parents as $ parent ) { $ addTo [ ] = "{$parent->ClassName},$parent->ID" ; $ this -> realiseAllSources ( $ parent , $ myIdent , $ addTo ) ; } } $ key = "sources_$myIdent" ; $ this -> getCache ( ) -> save ( $ addTo , $ key ) ; return $ addTo ; }
Realise all parent sources of the given node

This causes two things to be generated and stored

- the list of nodes that $node derives inherited permissions from,
indexed as source_nodeType_nodeID . This includes all generational ancestors,
not just immediate parents

- A graph of all the nodes that an item provides inherited permissions
to.


This allows us to provide more intelligent cache purging whenever nodes change,
so that the runtime permission cache can directly store the 'realised' permission
of things.


@param DataObject $node
@param array $addTo
Realise all parent sources of the given node