Changeset 12581

Show
Ignore:
Timestamp:
09/28/07 16:12:37 (1 year ago)
Author:
juhana
Message:

Bug fixing and cleaning up. Creating prefixed host still segfaults

Files:

Legend:

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

    r12109 r12581  
    1616    $sitewizard = new midgard_admin_sitewizard(); 
    1717    $sitewizard->set_verbose(true); 
    18    
    19   /*   
     18     
    2019    $sitegroup_creator = $sitewizard->initialize_sitegroup_creation(); 
    21     $sitegroup_creator->set_sitegroup_name("Koe13"); 
     20    $sitegroup_creator->set_sitegroup_name("Koe52"); 
    2221    $sitegroup_creator->set_sitegroup_admin_username("juuseri"); 
    2322    $sitegroup_creator->set_sitegroup_admin_password("passu"); 
    2423      
    2524    $host_creator = $sitegroup_creator->next_link(); 
    26      
    27     print_r($host_creator); 
     25    $host_creator->set_verbose(true); 
    2826     
    2927    // 5d6c1efa5aad11dca2b901052dafd248d248 
     
    3331    $host_creator->set_host_prefix('/jee'); 
    3432     
    35     $host_creator->execute(); 
     33    //print_r($host_creator); 
     34     
     35    //$host_creator->execute(); 
    3636     
    3737    
    38     print_r($host_creator); 
     38    //print_r($host_creator); 
    3939     
    40     $parent = $host_creator->previous_link(); 
    41     print_r($parent); 
    42     */ 
     40    //$parent = $host_creator->previous_link(); 
     41    //print_r($parent); 
     42     
    4343    //$sitegroup_creator->execute(); 
    4444     
    4545 
    46     $structure_creator = $sitewizard->initialize_structure_creation('983e66725acd11db845a197adaa843af43af'); 
     46    //$structure_creator = $sitewizard->initialize_structure_creation('983e66725acd11db845a197adaa843af43af'); 
     47    $structure_creator = $host_creator->next_link(); 
     48    $structure_creator->set_verbose(true); 
    4749    $structure_creator->read_config('structure_config.inc'); 
    4850    $structure_creator->alter_config(array('blog', 'root', 'name'), 'jee'); 
    4951     
     52    //$structure_creator->set_creation_root_topic('6d3af3384be911dcb7b0b3bf4b275d0d5d0d'); 
     53    $structure_creator->create_creation_root_topic('6d3af3384be911dcb7b0b3bf4b275d0d5d0d', "test15", "Test15", "net.nehmer.static", array("koe" => array("koe"))); 
     54    //$structure_creator->set_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c');  
     55    $structure_creator->create_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c', "testgroup21"); 
     56    $structure_creator->execute();  
    5057     
    51     /* 
    52     //$structure_creator->set_creation_root_topic('6d3af3384be911dcb7b0b3bf4b275d0d5d0d'); 
    53     $structure_creator->create_creation_root_topic('6d3af3384be911dcb7b0b3bf4b275d0d5d0d', "test", "Test", "net.nehmer.static", array("koe", "koe", "koe")); 
    54     //$structure_creator->set_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c');  
    55     $structure_creator->create_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c', "testgroup8"); 
    56     $structure_creator->execute();  
    57     */ 
    5858} 
    5959catch (midgard_admin_sitewizard_exception $e) 
  • trunk/midgard/data/midgard_admin_sitewizard_creator_host.php

    r12066 r12581  
    2626     
    2727    private $host_style_id = null; 
    28      
    29      
     28       
    3029 
    3130    public function __construct($parent_link = null) 
    3231    { 
    3332        parent::__construct($parent_link); 
    34          
    35         if (is_object($parent_link)) 
    36         { 
    37             $this->sitegroup = $this->parent_link->get_sitegroup(); 
    38         } 
    3933    } 
    4034     
     
    6862        $this->host->sitegroup = $this->sitegroup->id; 
    6963        $this->host->name = $this->host_url; 
    70         $this->host->prefix = $this->host_prefix; 
    7164        $this->host->port = 80; 
    7265        $this->host->online = 1; 
     
    7770            $this->host->style = $this->host_style_id; 
    7871        } 
    79          
     72 
    8073        if (!$this->host->create()) 
    8174        { 
     
    8578        else 
    8679        { 
     80            $this->host->prefix = $this->host_prefix; 
     81            //print_r($this->host); 
     82            if (!$this->host->update()) 
     83            { 
     84                throw new midgard_admin_sitewizard_exception("Failed to set host prefix for host GUID: "  
     85                    . $this->host->guid); 
     86            } 
     87         
    8788            $this->verbose("Created host PREFIX: " . $host->name . $host->prefix . " GUID: "  
    8889                . $this->host->guid); 
     
    129130    public function set_host_style($style_id) 
    130131    { 
     132        $this->verbose("Setting host style id: " . $style_id); 
     133     
    131134        $this->host_style_id = $style_id; 
    132135    } 
     
    148151    public function cleanup() 
    149152    { 
    150      
     153        $this->verbose("Host creator cleaning up!!"); 
     154     
     155        if (is_object($this->root_page)) 
     156        $this->root_page->delete(); 
     157        if (is_object($this->host)) 
     158        $this->host->delete(); 
    151159    } 
    152160     
     
    166174    } 
    167175     
     176    public function get_host() 
     177    { 
     178        return $this->host; 
     179    } 
     180     
    168181    public function execute() 
    169182    { 
     
    176189                try 
    177190                { 
    178                 $this->parent_link->execute();           
     191                $this->parent_link->execute();   
     192                 
     193                if (is_object($this->parent_link)) 
     194                { 
     195                    $this->sitegroup = $this->parent_link->get_sitegroup(); 
     196                }        
    179197                } 
    180198                catch (midgard_admin_sitewizard_exception $e) 
     
    191209                $this->create_root_page(); 
    192210 
    193                 $this->verbose("Sitewizard created host successfully. Now cleaning up..."); 
    194  
    195                 $this->cleanup(); 
     211                $this->verbose("Sitewizard created host successfully."); 
    196212                 
    197213                //return $this->creation_root_topic->guid; 
     
    200216            { 
    201217                $e->error();       
     218                 
    202219            $this->cleanup(); 
    203220   
  • trunk/midgard/data/midgard_admin_sitewizard_creator_sitegroup.php

    r12012 r12581  
    214214    public function cleanup() 
    215215    { 
    216      
     216        $this->verbose("Sitegroup creator cleaning up!"); 
     217     
     218        if (is_object($this->sitegroup_admin_user)) 
     219        $this->sitegroup_admin_user->delete(); 
     220        if (is_object($this->sitegroup_admin_group)) 
     221        $this->sitegroup_admin_group->delete(); 
     222        if (is_object($this->sitegroup)) 
     223        $this->sitegroup->delete(); 
    217224    } 
    218225     
     
    241248                $this->create_sitegroup_admin_group(); 
    242249                $this->create_sitegroup_admin_user(); 
     250                 
     251                $this->verbose('Sitegroup created successfully.'); 
    243252         
    244253                return true; 
  • trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php

    r12561 r12581  
    1414    private $host = null; 
    1515 
    16     private $host_creator = null; 
     16    //private $host_creator = null; 
    1717 
    1818    private $root_topic = null; 
     
    3232    private $created_groups = array(); 
    3333 
    34     public function __construct($host_creator = null) 
     34    public function __construct($parent_link = null) 
    3535    { 
    3636        // Always a good idea to run parent constructor 
    37         parent::__construct($host_creator); 
     37        parent::__construct($parent_link); 
    3838    } 
    3939 
     
    4545    protected function cleanup() 
    4646    { 
    47         $this->verbose('Cleaning up!'); 
     47        $this->verbose('Structure creator cleaning up!'); 
    4848 
    4949    } 
     
    5353        $this->verbose('Initializing structure creation'); 
    5454 
    55         if ($this->host_creator == null) 
     55        if ($this->host == null) 
    5656         { 
    5757            if (!$this->host = new midgard_host($host_guid)) 
     
    113113             
    114114            $arr_ref = $value;   
    115              
    116             print_r($this->config); 
    117115        } 
    118116        else 
     
    624622            try 
    625623            { 
    626                 $this->parent_link->execute();         
     624                $this->parent_link->execute();  
     625                 
     626                if (is_object($this->parent_link)) 
     627                { 
     628                    $this->host = $this->parent_link->get_host(); 
     629                }        
    627630            } 
    628631            catch (midgard_admin_sitewizard_exception $e) 
     
    639642            $this->create_topic_structure(); 
    640643 
    641             $this->verbose("Sitewizard created website structure successfully. Now cleaning up..."); 
    642  
    643             $this->cleanup(); 
     644            $this->verbose("Sitewizard created website structure successfully."); 
    644645             
    645646            return $this->creation_root_topic->guid; 
     
    647648        catch(midgard_admin_sitewizard_exception $e) 
    648649        { 
    649             $e->error();       
     650            $e->error();      
     651            //$this->parent_link->cleanup()  
    650652            $this->cleanup(); 
    651653