Changeset 12581
- Timestamp:
- 09/28/07 16:12:37 (1 year ago)
- Files:
-
- trunk/midgard/data/midgard_admin_sitewizard_cli.php (modified) (2 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_creator_host.php (modified) (10 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_creator_sitegroup.php (modified) (2 diffs)
- trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midgard/data/midgard_admin_sitewizard_cli.php
r12109 r12581 16 16 $sitewizard = new midgard_admin_sitewizard(); 17 17 $sitewizard->set_verbose(true); 18 19 /* 18 20 19 $sitegroup_creator = $sitewizard->initialize_sitegroup_creation(); 21 $sitegroup_creator->set_sitegroup_name("Koe 13");20 $sitegroup_creator->set_sitegroup_name("Koe52"); 22 21 $sitegroup_creator->set_sitegroup_admin_username("juuseri"); 23 22 $sitegroup_creator->set_sitegroup_admin_password("passu"); 24 23 25 24 $host_creator = $sitegroup_creator->next_link(); 26 27 print_r($host_creator); 25 $host_creator->set_verbose(true); 28 26 29 27 // 5d6c1efa5aad11dca2b901052dafd248d248 … … 33 31 $host_creator->set_host_prefix('/jee'); 34 32 35 $host_creator->execute(); 33 //print_r($host_creator); 34 35 //$host_creator->execute(); 36 36 37 37 38 print_r($host_creator);38 //print_r($host_creator); 39 39 40 $parent = $host_creator->previous_link();41 print_r($parent);42 */40 //$parent = $host_creator->previous_link(); 41 //print_r($parent); 42 43 43 //$sitegroup_creator->execute(); 44 44 45 45 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); 47 49 $structure_creator->read_config('structure_config.inc'); 48 50 $structure_creator->alter_config(array('blog', 'root', 'name'), 'jee'); 49 51 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(); 50 57 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 */58 58 } 59 59 catch (midgard_admin_sitewizard_exception $e) trunk/midgard/data/midgard_admin_sitewizard_creator_host.php
r12066 r12581 26 26 27 27 private $host_style_id = null; 28 29 28 30 29 31 30 public function __construct($parent_link = null) 32 31 { 33 32 parent::__construct($parent_link); 34 35 if (is_object($parent_link))36 {37 $this->sitegroup = $this->parent_link->get_sitegroup();38 }39 33 } 40 34 … … 68 62 $this->host->sitegroup = $this->sitegroup->id; 69 63 $this->host->name = $this->host_url; 70 $this->host->prefix = $this->host_prefix;71 64 $this->host->port = 80; 72 65 $this->host->online = 1; … … 77 70 $this->host->style = $this->host_style_id; 78 71 } 79 72 80 73 if (!$this->host->create()) 81 74 { … … 85 78 else 86 79 { 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 87 88 $this->verbose("Created host PREFIX: " . $host->name . $host->prefix . " GUID: " 88 89 . $this->host->guid); … … 129 130 public function set_host_style($style_id) 130 131 { 132 $this->verbose("Setting host style id: " . $style_id); 133 131 134 $this->host_style_id = $style_id; 132 135 } … … 148 151 public function cleanup() 149 152 { 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(); 151 159 } 152 160 … … 166 174 } 167 175 176 public function get_host() 177 { 178 return $this->host; 179 } 180 168 181 public function execute() 169 182 { … … 176 189 try 177 190 { 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 } 179 197 } 180 198 catch (midgard_admin_sitewizard_exception $e) … … 191 209 $this->create_root_page(); 192 210 193 $this->verbose("Sitewizard created host successfully. Now cleaning up..."); 194 195 $this->cleanup(); 211 $this->verbose("Sitewizard created host successfully."); 196 212 197 213 //return $this->creation_root_topic->guid; … … 200 216 { 201 217 $e->error(); 218 202 219 $this->cleanup(); 203 220 trunk/midgard/data/midgard_admin_sitewizard_creator_sitegroup.php
r12012 r12581 214 214 public function cleanup() 215 215 { 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(); 217 224 } 218 225 … … 241 248 $this->create_sitegroup_admin_group(); 242 249 $this->create_sitegroup_admin_user(); 250 251 $this->verbose('Sitegroup created successfully.'); 243 252 244 253 return true; trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php
r12561 r12581 14 14 private $host = null; 15 15 16 private $host_creator = null;16 //private $host_creator = null; 17 17 18 18 private $root_topic = null; … … 32 32 private $created_groups = array(); 33 33 34 public function __construct($ host_creator= null)34 public function __construct($parent_link = null) 35 35 { 36 36 // Always a good idea to run parent constructor 37 parent::__construct($ host_creator);37 parent::__construct($parent_link); 38 38 } 39 39 … … 45 45 protected function cleanup() 46 46 { 47 $this->verbose(' Cleaning up!');47 $this->verbose('Structure creator cleaning up!'); 48 48 49 49 } … … 53 53 $this->verbose('Initializing structure creation'); 54 54 55 if ($this->host _creator== null)55 if ($this->host == null) 56 56 { 57 57 if (!$this->host = new midgard_host($host_guid)) … … 113 113 114 114 $arr_ref = $value; 115 116 print_r($this->config);117 115 } 118 116 else … … 624 622 try 625 623 { 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 } 627 630 } 628 631 catch (midgard_admin_sitewizard_exception $e) … … 639 642 $this->create_topic_structure(); 640 643 641 $this->verbose("Sitewizard created website structure successfully. Now cleaning up..."); 642 643 $this->cleanup(); 644 $this->verbose("Sitewizard created website structure successfully."); 644 645 645 646 return $this->creation_root_topic->guid; … … 647 648 catch(midgard_admin_sitewizard_exception $e) 648 649 { 649 $e->error(); 650 $e->error(); 651 //$this->parent_link->cleanup() 650 652 $this->cleanup(); 651 653
