Changeset 13068
- Timestamp:
- 10/24/07 17:40:44 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midgard/data/midgard_admin_sitewizard_creator_host.php
r12966 r13068 30 30 31 31 private $page_title = ''; 32 33 private $copy_host = null; 34 35 private $make_host_copy = false; 36 37 private $copy_host_url = ''; 38 39 private $copy_host_prefix = ''; 40 41 private $copy_host_port = ''; 32 42 33 43 … … 85 95 $extend_style->sitegroup = $this->sitegroup->id; 86 96 $extend_style->name = sprintf('%s for %s', $styles[0]->name, 87 $this->host_url . str_replace('/', ':', $this->host_prefix));97 $this->host_url . str_replace('/', ':', $this->host_prefix)); 88 98 89 99 if (!$extend_style->create()) … … 120 130 } 121 131 132 private function copy_host() 133 { 134 $this->verbose("Starting to create copy host for sitegroup GUID: " . $this->sitegroup->guid); 135 136 $this->copy_host = new midgard_host(); 137 $this->copy_host->sitegroup = $this->host->sitegroup; 138 139 if (!empty($this->copy_host_url)) 140 { 141 $this->copy_host->name = $this->copy_host_url; 142 } 143 else 144 { 145 $this->copy_host->name = $this->host->name; 146 } 147 148 if (!empty($this->copy_host_port)) 149 { 150 $this->copy_host->port = $this->copy_host_port; 151 } 152 else 153 { 154 $this->copy_host->name = $this->host->port; 155 } 156 157 if (!empty($this->copy_host_prefix)) 158 { 159 $this->copy_host->prefix = $this->copy_host_prefix; 160 } 161 else 162 { 163 $this->copy_host->prefix = $this->host->prefix; 164 } 165 $this->copy_host->online = 1; 166 $this->copy_host->owner = $this->host->owner; 167 $this->copy_host->style = $this->host->style; 168 $this->copy_host->root = $this->host->root; 169 170 if (!$this->copy_host->create()) 171 { 172 throw new midgard_admin_sitewizard_exception("Failed to create host copy of host GUID " 173 . $this->shost->guid); 174 } 175 } 176 122 177 private function create_root_page() 123 178 { … … 128 183 $this->root_page->up = 0; 129 184 $this->root_page->name = $this->host->name . $this->host->prefix . " root"; 185 $this->root_page->content = "<?php \$_MIDCOM->content(); ?>\n"; 186 $this->root_page->author = 1; 187 $this->root_page->info = 'active'; 130 188 131 189 if ($this->page_title == '') … … 148 206 149 207 $this->host->root = $this->root_page->id; 208 209 $code_finish = new midgard_pageelement(); 210 $code_finish->name = "code-finish"; 211 $code_finish->page = $this->root_page->id; 212 $code_finish->info = 'inherit'; 213 $code_finish->value = "<?php \$_MIDCOM->finish(); ?>\n"; 214 215 if (!$code_finish->create()) 216 { 217 throw new midgard_admin_sitewizard_exception("Failed to create code-finish. Reason: " 218 . mgd_errstr()); 219 } 150 220 151 221 if (!$this->host->update()) … … 194 264 { 195 265 $this->page_title = $page_title; 266 } 267 268 public function set_make_host_copy($make_host_copy) 269 { 270 $this->make_host_copy = $make_host_copy; 271 } 272 273 public function set_copy_host_url($url) 274 { 275 $this->copy_host_url = $url; 276 } 277 278 public function set_copy_host_port($port) 279 { 280 $this->copy_host_port = $port; 281 } 282 283 public function set_copy_host_prefix($prefix) 284 { 285 $this->copy_host_prefix = $prefix; 196 286 } 197 287 … … 267 357 $this->create_host(); 268 358 $this->create_root_page(); 359 360 if ($this->make_host_copy) 361 { 362 $this->copy_host(); 363 } 269 364 270 365 $this->verbose("Sitewizard created host successfully."); trunk/midgard/data/midgard_admin_sitewizard_creator_structure.php
r12966 r13068 35 35 36 36 private $schemavalues = array(); 37 38 private $midcom_path = ''; 37 39 38 40 public function __construct($parent_link = null) … … 159 161 $article->title = $title; 160 162 $article->name = 'index'; 163 $article->sitegroup = $this->sitegroup->id; 161 164 162 165 if (!$article->create()) … … 493 496 $this->creation_root_topic->extra = $this->replace($this->structure['root']['title']); 494 497 $this->creation_root_topic->name = $this->replace($this->structure['root']['name']); 498 $this->creation_root_topic->component = $this->structure['root']['component']; 495 499 496 500 if (isset($node['root']['style']) && !empty($node['root']['style'])) … … 530 534 if (isset($this->structure['root']['create_index']) && $this->structure['root']['create_index'] == true) 531 535 { 532 $this->create_index_article($this->creation_root_topic->id, $this->replace($ node['root']['title']));536 $this->create_index_article($this->creation_root_topic->id, $this->replace($this->structure['root']['title'])); 533 537 } 534 538 } … … 724 728 return $this->creation_root_group; 725 729 } 730 731 public function set_midcom_path($path) 732 { 733 $this->midcom_path = $path; 734 } 735 736 private function create_code_init() 737 { 738 $code_init = new midgard_pageelement(); 739 $code_init->name = 'code-init'; 740 $code_init->page = $this->root_page->id; 741 $code_init->info = 'inherit'; 742 $code_init->value = "<?php 743 744 \$GLOBALS['midcom_config_local']['cache_base_directory'] = '/var/cache/midgard/midcom/'; 745 \$GLOBALS['midcom_config_local']['log_filename'] = '/var/log/midgard/midcom/{$this->host->name}.log'; 746 \$GLOBALS['midcom_config_local']['log_level'] = '0'; 747 \$GLOBALS['midcom_config_local']['midcom_root_topic_guid'] = '{$this->creation_root_topic->guid}'; 748 749 define ('MIDCOM_ROOT', '{$this->midcom_path}'); 750 751 ?><(code-init-before-midcom)><?php 752 753 require 'midcom/lib/midcom.php'; 754 755 ?><(code-init-after-midcom)><?php 756 757 \$_MIDCOM->codeinit(); 758 759 ?>"; 760 761 $code_init->create(); 762 } 726 763 727 764 public function execute() … … 756 793 $this->create_group_structure(); 757 794 $this->create_topic_structure(); 795 $this->create_code_init(); 758 796 759 797 $this->verbose("Sitewizard created website structure successfully.");
