Changeset 13133

Show
Ignore:
Timestamp:
10/29/07 08:56:28 (1 year ago)
Author:
juhana
Message:

Implemented symlinking

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php

    r13068 r13133  
    3737     
    3838    private $midcom_path = ''; 
     39     
     40    private $symlink_sources = array(); 
     41     
     42    private $symlink_targets = array(); 
    3943 
    4044    public function __construct($parent_link = null) 
     
    174178         
    175179        return false;       
     180    } 
     181     
     182    public function create_symlinks() 
     183    { 
     184        if (count($this->symlink_sources) > 0) 
     185        { 
     186            foreach($this->symlink_sources as $source_id => $guid) 
     187            { 
     188                if (array_key_exists($source_id, $this->symlink_targets)) 
     189                { 
     190                    $this->verbose("Creating symlink GUID: " . $guid); 
     191                 
     192                    $targets = $this->symlink_targets[$source_id]; 
     193                     
     194                    foreach($targets as $target) 
     195                    {          
     196                        $target->parameter($target->component, 'symlink_topic', $guid); 
     197                      
     198                        if (!$target->update()) 
     199                        { 
     200                            throw new midgard_admin_sitewizard_exception("Failed create symlink GUID: "  
     201                                . $guid . " Reason: " . mgd_errstr());  
     202                        } 
     203                    } 
     204                } 
     205            } 
     206        } 
    176207    } 
    177208 
     
    398429                } 
    399430                 
     431                // Creating index article 
    400432                if (isset($node['create_index']) && $node['create_index'] == true) 
    401433                { 
    402434                    $this->create_index_article($topic->id, $this->replace($node['title'])); 
     435                } 
     436                 
     437                // Adding symlink source 
     438                if (isset($node['symlink_source_id'])) 
     439                { 
     440                    $this->symlink_sources[$node['symlink_source_id']] = $topic->guid; 
     441                } 
     442                 
     443                // Adding symlink target 
     444                if (isset($node['symlink_target_id'])) 
     445                { 
     446                    $this->symlink_targets[$node['symlink_target_id']][] = $topic; 
     447                } 
     448                 
     449                // Setting styleInherit 
     450                if (isset($node['styleInherit']) && $node['styleInherit'] == true) 
     451                { 
     452                    $this->creation_root_topic->styleInherit = 1; 
     453                } 
     454                 
     455                // Setting style 
     456                if (isset($node['style'])) 
     457                { 
     458                    $this->creation_root_topic->style = $node['style']; 
    403459                } 
    404460            } 
     
    530586                { 
    531587                    $this->set_privileges($this->structure['root'], $this->creation_root_topic); 
     588                } 
     589                 
     590                // Setting styleInherit 
     591                if (isset($this->structure['root']['styleInherit']) && $this->structure['root']['styleInherit'] == true) 
     592                { 
     593                    $this->creation_root_topic->styleInherit = 1; 
    532594                } 
    533595                 
     
    793855            $this->create_group_structure(); 
    794856            $this->create_topic_structure(); 
     857            $this->create_symlinks(); 
    795858            $this->create_code_init(); 
    796859