Changeset 12143

Show
Ignore:
Timestamp:
09/12/07 09:16:56 (1 year ago)
Author:
piotras
Message:

Added config-set functionality.
Replaced 'normal' type with 'wizard' one

Files:

Legend:

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

    r11963 r12143  
    1313    'max'   => 1, 
    1414    'min'   => 1, 
    15     'desc'  => 'The type of installation. Normal or quick ( default )', 
     15    'desc'  => 'The type of installation.', 
    1616    'default' => 'quick', 
    1717); 
    18 $setup_types = array('normal', 'quick'); 
     18$setup_types = array('wizard', 'quick', 'config'); 
    1919 
    2020/* Action to perform. Install, update, install pear packages, etc */ 
     
    2626    'default' => 'install', 
    2727); 
    28 $setup_actions = array('install', 'update', 'pear', 'vhost', 'dbupdate');    
     28$setup_actions = array('install', 'update', 'pear', 'vhost', 'dbupdate', 'config-set');    
    2929 
    3030/* Configuration name , by default we should keep config file named from database name */ 
     
    3333    'max'   => 1, 
    3434    'min'   => 0, 
    35     'desc'  => 'Midgard configuration name ( midgard by default ).', 
     35    'desc'  => 'Midgard configuration name.', 
     36    'default' => "" 
     37); 
     38 
     39/* Set configuration key's value */ 
     40$opts_config['config-set'] = array ( 
     41    'short' => 's', 
     42    'max'   => 2, 
     43    'min'   => 2, 
     44    'desc'  => 'Sets key value for the named configuration.', 
    3645    'default' => "" 
    3746); 
     
    6271switch ($arg_type) { 
    6372 
    64     case 'normal': 
     73    case 'wizard': 
    6574        
    66        midgard_setup_cli::error("Normal type not yet implemented"); 
     75       midgard_setup_cli::error("Wizard type not yet implemented"); 
    6776        
    6877       break; 
     78 
     79    case 'config': 
     80         
     81        /* Be quiet */ 
     82         
     83        break; 
    6984 
    7085    default: 
     
    89104         * It should removed once role_midgardelement gets username using midgard_config class  
    90105         */ 
    91         $config = &$setup->midgard_config; 
     106        //$config = &$setup->midgard_config; 
     107        $config = new midgard_config(); 
     108        $config->read_file("midgard"); 
    92109        $config->midgardusername = "admin"; 
    93110        $config->midgardpassword = "password"; 
     
    107124    case 'vhost':       
    108125         
    109         $user_host = midgard_setup_cli::get_text(_("Hostname ?")); 
    110         $user_port = midgard_setup_cli::get_text(_("Hostname port (80 by default)?")); 
    111         $user_prefix = ""; 
    112         if($arg_type == 'normal') 
    113             $user_prefix = midgard_setup_cli::get_text(_("Hostname prefix ?")); 
     126        $setup->install_vhost(); 
     127         
     128        break; 
    114129 
    115         $setup->set_vhost($user_host, $user_port, $user_prefix); 
    116         $setup->install_vhost(); 
     130    case 'config-set': 
     131 
     132        if($arg_config == "") 
     133            midgard_setup_cli::error(_("'config-set' requires configuration")); 
     134 
     135        $mc = new midgard_config(); 
     136        $mc->read_file($arg_config); 
     137        
     138        $kv = $args->getValue('config-set'); 
     139 
     140        $mc->{$kv[0]} = $kv[1]; 
     141        $mc->save_file($arg_config); 
    117142         
    118143        break;