Changeset 12012
- Timestamp:
- 09/04/07 16:19:13 (1 year ago)
- Files:
-
- trunk/midgard/data/midgard_admin_sitewizard.php (modified) (4 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_cli.php (modified) (2 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_creator.php (modified) (5 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_creator_host.php (added)
- trunk/midgard/data/midgard_admin_sitewizard_creator_sitegroup.php (added)
- trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midgard/data/midgard_admin_sitewizard.php
r11619 r12012 8 8 9 9 require_once('midgard_admin_sitewizard_creator_structure.php'); 10 require_once('midgard_admin_sitewizard_creator_sitegroup.php'); 10 11 require_once('midgard_admin_sitewizard_exception.php'); 11 12 … … 19 20 { 20 21 $this->verbose = false; 21 $this->current_state = null;22 $this->current_state = null; 22 23 } 23 24 … … 34 35 public function initialize_sitegroup_creation() 35 36 { 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; 37 52 } 38 53 39 public function initialize_host_creation( )54 public function initialize_host_creation($sitegroup_guid) 40 55 { 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; 42 73 } 43 74 … … 45 76 { 46 77 try 47 {78 { 48 79 $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); 55 87 56 return false; 57 } 88 return false; 89 } 90 91 $this->current_state = $structure_creator; 58 92 59 return $structure_creator;93 return $structure_creator; 60 94 } 61 95 trunk/midgard/data/midgard_admin_sitewizard_cli.php
r11641 r12012 17 17 $sitewizard->set_verbose(true); 18 18 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 /* 19 45 $structure_creator = $sitewizard->initialize_structure_creation('983e66725acd11db845a197adaa843af43af'); 20 46 $structure_creator->read_config('structure_config.inc'); … … 24 50 $structure_creator->create_creation_root_group('94f058364f0f11dc93f803ebc4b67c0c7c0c', "testgroup8"); 25 51 $structure_creator->execute(); 52 */ 26 53 } 27 54 catch (midgard_admin_sitewizard_exception $e) trunk/midgard/data/midgard_admin_sitewizard_creator.php
r11641 r12012 9 9 abstract class midgard_admin_sitewizard_creator 10 10 { 11 protected $varbose = false;11 protected $varbose = false; 12 12 13 13 protected $parent_link = null; … … 15 15 protected $next_link = null; 16 16 17 protected $start_chain = true;17 protected $start_chain = true; 18 18 19 public function __construct($parent_link = null)19 public function __construct($parent_link = null) 20 20 { 21 21 $this->parent_link = $parent_link; … … 24 24 public function __destruct() 25 25 { 26 unset($this->parent_link);26 unset($this->parent_link); 27 27 unset($this->next_link); 28 28 } 29 29 30 30 abstract protected function cleanup(); 31 32 abstract protected function initialize($guid); 31 33 32 abstract protected function read_config($path);34 //abstract protected function read_config($path); 33 35 34 36 abstract protected function execute(); … … 43 45 } 44 46 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) 46 53 { 47 54 $this->start_chain = $start; 48 55 } 49 50 protected function get_parent_link()51 {52 return $this->parent_link;53 }54 56 55 57 protected function verbose($message = "") … … 60 62 } 61 63 } 64 65 public function sitewizard_auth_user() 66 { 67 68 } 62 69 63 70 public function set_verbose($verbose) trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php
r11954 r12012 57 57 if (!$this->host = new midgard_host($host_guid)) 58 58 { 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()); 61 61 62 62 return false; … … 78 78 $root_topic_guid = $this->root_page->parameter('midgard', 'midcom_root_topic_guid'); 79 79 80 if (! mgd_is_guid($root_topic_guid))80 if (!empty($root_topic_guid)) 81 81 { 82 82 throw new midgard_admin_sitewizard_exception("Failed to get valid root topic … … 607 607 catch(midgard_admin_sitewizard_exception $e) 608 608 { 609 $e->error(); 610 609 $e->error(); 611 610 $this->cleanup(); 612 611
