Changeset 12012

Show
Ignore:
Timestamp:
09/04/07 16:19:13 (1 year ago)
Author:
juhana
Message:

Implemented host and sitegroup creation...still alot to do...

Files:

Legend:

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

    r11619 r12012  
    88  
    99require_once('midgard_admin_sitewizard_creator_structure.php'); 
     10require_once('midgard_admin_sitewizard_creator_sitegroup.php'); 
    1011require_once('midgard_admin_sitewizard_exception.php'); 
    1112 
     
    1920    {            
    2021        $this->verbose = false; 
    21         $this->current_state = null;   
     22            $this->current_state = null;       
    2223    } 
    2324 
     
    3435    public function initialize_sitegroup_creation() 
    3536    { 
    36                  
     37        try 
     38            { 
     39            $sitegroup_creator = new midgard_admin_sitewizard_creator_sitegroup(); 
     40                $sitegroup_creator->set_verbose($this->verbose); 
     41            } 
     42            catch (midgard_admin_sitewizard_exception $e) 
     43            { 
     44            throw new midgard_admin_sitewizard_exception("Failed to initialize sitegroup creation"); 
     45 
     46                return false; 
     47            } 
     48             
     49            $this->current_state = $sitegroup_creator; 
     50 
     51            return $sitegroup_creator;           
    3752    } 
    3853         
    39     public function initialize_host_creation(
     54    public function initialize_host_creation($sitegroup_guid
    4055    { 
    41                                  
     56        try 
     57            { 
     58            $host_creator = new midgard_admin_sitewizard_creator_host(); 
     59                $host_creator->set_verbose($this->verbose); 
     60                $host_creator->initialize($sitegroup_guid); 
     61            } 
     62            catch (midgard_admin_sitewizard_exception $e) 
     63            { 
     64            throw new midgard_admin_sitewizard_exception("Failed to initialize host creation  
     65                for sitegroup GUID: " . $sitegroup_guid); 
     66 
     67                return false; 
     68            } 
     69             
     70            $this->current_state = $host_creator; 
     71 
     72            return $host_creator;                                
    4273    } 
    4374         
     
    4576    {    
    4677        try 
    47        
     78           
    4879            $structure_creator = new midgard_admin_sitewizard_creator_structure(); 
    49             $structure_creator->set_verbose($this->verbose); 
    50             $structure_creator->initialize($host_guid); 
    51         } 
    52         catch (midgard_admin_sitewizard_exception $e) 
    53         { 
    54             throw new midgard_admin_sitewizard_exception("Failed to initialize structure creation for host GUID: " . $host_guid); 
     80                $structure_creator->set_verbose($this->verbose); 
     81                $structure_creator->initialize($host_guid); 
     82            } 
     83            catch (midgard_admin_sitewizard_exception $e) 
     84            { 
     85            throw new midgard_admin_sitewizard_exception("Failed to initialize structure creation  
     86                for host GUID: " . $host_guid); 
    5587 
    56             return false; 
    57         } 
     88                return false; 
     89            } 
     90             
     91            $this->current_state = $structure_creator; 
    5892 
    59         return $structure_creator; 
     93            return $structure_creator; 
    6094    } 
    6195         
  • trunk/midgard/data/midgard_admin_sitewizard_cli.php

    r11641 r12012  
    1717    $sitewizard->set_verbose(true); 
    1818     
     19    $sitegroup_creator = $sitewizard->initialize_sitegroup_creation(); 
     20    $sitegroup_creator->set_sitegroup_name("Koe12"); 
     21    $sitegroup_creator->set_sitegroup_admin_username("juuseri"); 
     22    $sitegroup_creator->set_sitegroup_admin_password("passu"); 
     23      
     24    $host_creator = $sitegroup_creator->next_link(); 
     25     
     26    print_r($host_creator); 
     27     
     28    // 5d6c1efa5aad11dca2b901052dafd248d248 
     29     
     30    //$host_creator = $sitewizard->initialize_host_creation('5d6c1efa5aad11dca2b901052dafd248d248'); 
     31    $host_creator->set_host_url('http://www.jee.com'); 
     32    $host_creator->set_host_prefix('/jee'); 
     33     
     34    $host_creator->execute(); 
     35     
     36   /*  
     37    print_r($host_creator); 
     38     
     39    $parent = $host_creator->previous_link(); 
     40    print_r($parent); 
     41    */ 
     42    //$sitegroup_creator->execute(); 
     43     
     44    /* 
    1945    $structure_creator = $sitewizard->initialize_structure_creation('983e66725acd11db845a197adaa843af43af'); 
    2046    $structure_creator->read_config('structure_config.inc'); 
     
    2450    $structure_creator->create_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c', "testgroup8"); 
    2551    $structure_creator->execute();  
     52    */ 
    2653} 
    2754catch (midgard_admin_sitewizard_exception $e) 
  • trunk/midgard/data/midgard_admin_sitewizard_creator.php

    r11641 r12012  
    99abstract class midgard_admin_sitewizard_creator 
    1010{ 
    11         protected $varbose = false; 
     11    protected $varbose = false; 
    1212 
    1313        protected $parent_link = null;   
     
    1515        protected $next_link = null; 
    1616 
    17         protected $start_chain = true; 
     17    protected $start_chain = true; 
    1818 
    19         public function __construct($parent_link = null) 
     19    public function __construct($parent_link = null) 
    2020        { 
    2121            $this->parent_link = $parent_link; 
     
    2424        public function __destruct() 
    2525        { 
    26             unset($this->parent_link); 
     26        unset($this->parent_link); 
    2727            unset($this->next_link); 
    2828        } 
    2929 
    3030        abstract protected function cleanup(); 
     31         
     32        abstract protected function initialize($guid); 
    3133 
    32         abstract protected function read_config($path); 
     34        //abstract protected function read_config($path); 
    3335         
    3436        abstract protected function execute(); 
     
    4345        } 
    4446         
    45         protected function start_chain($start) 
     47    protected function get_parent_link() 
     48        { 
     49                return $this->parent_link; 
     50        } 
     51         
     52    protected function start_chain($start) 
    4653        { 
    4754            $this->start_chain = $start; 
    4855        } 
    49  
    50         protected function get_parent_link() 
    51         { 
    52                 return $this->parent_link; 
    53         } 
    5456 
    5557        protected function verbose($message = "") 
     
    6062            } 
    6163        } 
     64         
     65    public function sitewizard_auth_user() 
     66    { 
     67     
     68    } 
    6269 
    6370        public function set_verbose($verbose) 
  • trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php

    r11954 r12012  
    5757            if (!$this->host = new midgard_host($host_guid)) 
    5858                { 
    59                         throw new midgard_admin_sitewizard_exception("Sitewizard couldn't initialize host object. Reason: "  
    60                             . mgd_errstr()); 
     59                        throw new midgard_admin_sitewizard_exception("Sitewizard couldn't initialize host  
     60                            object. Reason: " . mgd_errstr()); 
    6161 
    6262                    return false; 
     
    7878                $root_topic_guid = $this->root_page->parameter('midgard', 'midcom_root_topic_guid'); 
    7979 
    80                         if (!mgd_is_guid($root_topic_guid)) 
     80                        if (!empty($root_topic_guid)) 
    8181                        { 
    8282                    throw new midgard_admin_sitewizard_exception("Failed to get valid root topic  
     
    607607            catch(midgard_admin_sitewizard_exception $e) 
    608608            { 
    609                 $e->error(); 
    610              
     609                $e->error();       
    611610            $this->cleanup(); 
    612611