Changeset 11746
- Timestamp:
- 08/27/07 17:44:11 (1 year ago)
- Files:
-
- trunk/midgard/data/midgard_setup_pear.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midgard/data/midgard_setup_pear.php
r11745 r11746 16 16 require_once 'midgard_setup_globals.php'; 17 17 require_once 'midgard_setup_ui_cli_config.php'; 18 require_once 'midgard_setup_log.php'; 18 19 19 20 class midgard_setup_pear { … … 43 44 public function __construct() 44 45 { 46 midgard_setup_log::write(_("Initialize new ").__CLASS__); 47 45 48 $this->midcom_channel = "pear.midcom-project.org"; 46 49 $this->midcom_channel_alias = "midcom"; … … 81 84 ); 82 85 83 //$this->pear_config = new PEAR_Config();84 86 $this->pear_config = PEAR_Config::singleton(); 87 if(PEAR::IsError($this->pear_config)) 88 { 89 $msg = "Failed to initialize PEAR_Config::singleton"; 90 midgard_setup_log::write_exception($msg); 91 throw new Exception($msg, 0); 92 } 85 93 86 94 $this->initial_php_dir = $this->pear_config->get('php_dir'); … … 97 105 98 106 $this->pear_ui = new PEAR_Frontend_CLI(); 107 if(PEAR::IsError($this->pear_ui)) 108 { 109 $msg = "Failed to initialize PEAR_Frontend_CLI"; 110 midgard_setup_log::write_exception($msg); 111 throw new Exception($msg, 0); 112 } 99 113 100 114 $this->pear_channel = 101 115 new PEAR_Command_Channels(&$this->pear_ui, &$this->pear_config); 102 116 117 if(PEAR::IsError($this->pear_channel)) 118 { 119 $msg = "Failed to initialize PEAR_Command_Channels"; 120 midgard_setup_log::write_exception($msg); 121 throw new Exception($msg, 0); 122 } 123 103 124 $this->pear_installer = new PEAR_Installer(&$this->pear_ui, $this->pear_ui); 125 if(PEAR::IsError($this->pear_installer)) 126 { 127 $msg = "Failed to initialize PEAR_Installer"; 128 midgard_setup_log::write_exception($msg); 129 throw new Exception($msg, 0); 130 } 104 131 105 132 $this->pear_downloader = new PEAR_Downloader(&$this->pear_ui, 106 133 array('force' => 'yes'), &$this->pear_config); 134 if(PEAR::IsError($this->pear_downloader)) 135 { 136 $msg = "Failed to initialize PEAR_Downloader"; 137 midgard_setup_log::write_exception($msg); 138 throw new Exception($msg, 0); 139 } 107 140 108 141 $this->pear_registry = new PEAR_Registry(); 109 110 /* TODO */ 111 /* throw Exception when one of object can not be created */ 142 if(PEAR::IsError($this->pear_registry)) 143 { 144 $msg = "Failed to initialize PEAR_registry"; 145 midgard_setup_log::write_exception($msg); 146 throw new Exception($msg, 0); 147 } 112 148 } 113 149 … … 140 176 final public function install_midcom_roles() 141 177 { 178 midgard_setup_log::write(_("Installing MidCOM roles")); 179 142 180 /* Install or upgrade Role_Web */ 143 181 $this->install_pearified_base_package("Role_Web"); … … 184 222 185 223 final public function install_base_packages() 186 { 224 { 225 midgard_setup_log::write(_("Installing base packages")); 226 187 227 foreach($this->initial_midgard_packages as $name) 188 228 { … … 228 268 final public function install_midcom_package($name, $force = FALSE) 229 269 { 270 midgard_setup_log::write(_("Installing MidCOM package").$name); 271 230 272 $pkg_name = $this->midcom_channel_alias . "/" . $name; 231 273 … … 309 351 final public function set_channels() 310 352 { 311 353 midgard_setup_log::write(_("Setting MidCOM channels")); 354 312 355 /* update pear.php.net */ 313 356 $ret = $this->pear_channel->doUpdate('channel-update', … … 343 386 final public function update_channels() 344 387 { 388 midgard_setup_log::write(_("Updating MidCOM channels")); 389 345 390 /* update midcom channel */ 346 391 $ret = $this->pear_channel->doUpdate('channel-update',
