Changeset 250

Show
Ignore:
Timestamp:
06/05/07 17:10:46 (1 year ago)
Author:
ludo
Message:

lsc: task kill now working, directory upload, i18n fixes, tasks can be scheduled even with no ping. (from r4467)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/webmin/lsc/command_detail.php

    r227 r250  
    7878 */ 
    7979$query="SELECT 
    80         DATE_FORMAT(date_created, '%d-%m-%Y à %H:%i:%s'), 
    81         DATE_FORMAT(start_date, '%d-%m-%Y à %H:%i:%s'), 
    82         DATE_FORMAT(end_date, '%d-%m-%Y à %H:%i:%s'), 
     80        DATE_FORMAT(date_created, '%d-%m-%Y %H:%i:%s'), 
     81        DATE_FORMAT(start_date, '%d-%m-%Y %H:%i:%s'), 
     82        DATE_FORMAT(end_date, '%d-%m-%Y %H:%i:%s'), 
    8383        title, 
    8484        start_file, 
     
    121121        $template->set_var("COMMAND_PATH_SOURCE",$database->f("path_source")); 
    122122        if ($database->f("create_directory")=="enable") { 
    123                 $template->set_var("COMMAND_CREATE_DIRECTORY","oui"); 
    124         } else { 
    125                 $template->set_var("COMMAND_CREATE_DIRECTORY","non"); 
     123                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"yes"}); 
     124        } else { 
     125                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"no"}); 
    126126        } 
    127127         
    128128        if ($database->f("start_script")=="enable") { 
    129                 $template->set_var("COMMAND_START_SCRIPT", "oui"); 
    130         } else { 
    131                 $template->set_var("COMMAND_START_SCRIPT", "non"); 
     129                $template->set_var("COMMAND_START_SCRIPT", $text{"yes"}); 
     130        } else { 
     131                $template->set_var("COMMAND_START_SCRIPT", $text{"no"}); 
    132132        } 
    133133         
     
    146146         
    147147        if ($database->f("start_inventory")=="enable") { 
    148                 $template->set_var("COMMAND_START_INVENTORY","oui"); 
    149         } else { 
    150                 $template->set_var("COMMAND_START_INVENTORY","non"); 
     148                $template->set_var("COMMAND_START_INVENTORY",$text{"yes"}); 
     149        } else { 
     150                $template->set_var("COMMAND_START_INVENTORY",$text{"no"}); 
    151151        } 
    152152 
    153153        if ($database->f("wake_on_lan")=="enable") { 
    154                 $template->set_var("COMMAND_WAKE_ON_LAN","oui"); 
    155         } else { 
    156                 $template->set_var("COMMAND_WAKE_ON_LAN","non"); 
     154                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"yes"}); 
     155        } else { 
     156                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"no"}); 
    157157        }        
    158158         
  • trunk/webmin/lsc/command_history_detail.php

    r227 r250  
    8383 */ 
    8484$query="SELECT 
    85         DATE_FORMAT(date_created, '%d-%m-%Y à %H:%i:%s'), 
    86         DATE_FORMAT(start_date, '%d-%m-%Y à %H:%i:%s'), 
    87         DATE_FORMAT(end_date, '%d-%m-%Y à %H:%i:%s'), 
     85        DATE_FORMAT(date_created, '%d-%m-%Y %H:%i:%s'), 
     86        DATE_FORMAT(start_date, '%d-%m-%Y %H:%i:%s'), 
     87        DATE_FORMAT(end_date, '%d-%m-%Y %H:%i:%s'), 
    8888        title, 
    8989        start_file, 
     
    124124        $template->set_var("COMMAND_PATH_SOURCE",$database->f("path_source")); 
    125125        if ($database->f("create_directory")=="enable") { 
    126                 $template->set_var("COMMAND_CREATE_DIRECTORY","oui"); 
    127         } else { 
    128                 $template->set_var("COMMAND_CREATE_DIRECTORY","non"); 
     126                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"yes"}); 
     127        } else { 
     128                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"no"}); 
    129129        } 
    130130         
    131131        if ($database->f("start_script")=="enable") { 
    132                 $template->set_var("COMMAND_START_SCRIPT", "oui"); 
    133         } else { 
    134                 $template->set_var("COMMAND_START_SCRIPT", "non"); 
     132                $template->set_var("COMMAND_START_SCRIPT", $text{"yes"}); 
     133        } else { 
     134                $template->set_var("COMMAND_START_SCRIPT", $text{"no"}); 
    135135        } 
    136136         
     
    149149         
    150150        if ($database->f("start_inventory")=="enable") { 
    151                 $template->set_var("COMMAND_START_INVENTORY","oui"); 
    152         } else { 
    153                 $template->set_var("COMMAND_START_INVENTORY","non"); 
     151                $template->set_var("COMMAND_START_INVENTORY",$text{"yes"}); 
     152        } else { 
     153                $template->set_var("COMMAND_START_INVENTORY",$text{"no"}); 
    154154        } 
    155155 
    156156        if ($database->f("wake_on_lan")=="enable") { 
    157                 $template->set_var("COMMAND_WAKE_ON_LAN","oui"); 
    158         } else { 
    159                 $template->set_var("COMMAND_WAKE_ON_LAN","non"); 
     157                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"yes"}); 
     158        } else { 
     159                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"no"}); 
    160160        }        
    161161         
  • trunk/webmin/lsc/command_on_host_detail.php

    r227 r250  
    8585SELECT 
    8686        id_command, 
     87        DATE_FORMAT(next_launch_date, '%d-%m-%Y %H:%i:%s'), 
    8788        current_state, 
    8889        uploaded, 
    8990        executed, 
    9091        deleted, 
    91         host 
     92        host, 
     93        number_attempt_connection_remains 
    9294FROM 
    9395        ".COMMANDS_ON_HOST_TABLE." 
     
    123125} 
    124126 
     127$template->set_var("COMMAND_RUN_DATE", $database->f(1)); 
    125128$template->set_var("UPLOADED_ICON", return_icon($database->f("uploaded"))); 
    126129$template->set_var("EXECUTED_ICON", return_icon($database->f("executed"))); 
     
    129132$template->set_var("EXECUTED", $text[$database->f("executed")]); 
    130133$template->set_var("DELETED", $text[$database->f("deleted")]); 
     134$template->set_var("ATTEMPTS", $database->f("number_attempt_connection_remains")); 
    131135 
    132136switch ($database->f("current_state")) { 
     
    228232 */ 
    229233$query="SELECT 
    230         DATE_FORMAT(date_created, '%d-%m-%Y à %H:%i:%s'), 
    231         DATE_FORMAT(start_date, '%d-%m-%Y à %H:%i:%s'), 
    232         DATE_FORMAT(end_date, '%d-%m-%Y à %H:%i:%s'), 
     234        DATE_FORMAT(date_created, '%d-%m-%Y %H:%i:%s'), 
     235        DATE_FORMAT(start_date, '%d-%m-%Y %H:%i:%s'), 
     236        DATE_FORMAT(end_date, '%d-%m-%Y %H:%i:%s'), 
    233237        title, 
    234238        start_file, 
     
    249253        webmin_username 
    250254FROM 
    251         ".COMMANDS_TABLE." 
     255        ".COMMANDS_TABLE."  
    252256WHERE 
    253         id_command=\"".$id_command."\" 
     257        id_command=\"".$id_command."\"  
    254258"; 
    255259 
     
    272276        $template->set_var("COMMAND_PATH_SOURCE",$database->f("path_source")); 
    273277        if ($database->f("create_directory")=="enable") { 
    274                 $template->set_var("COMMAND_CREATE_DIRECTORY","oui"); 
    275         } else { 
    276                 $template->set_var("COMMAND_CREATE_DIRECTORY","non"); 
     278                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"yes"}); 
     279        } else { 
     280                $template->set_var("COMMAND_CREATE_DIRECTORY",$text{"no"}); 
    277281        } 
    278282         
    279283        if ($database->f("start_script")=="enable") { 
    280                 $template->set_var("COMMAND_START_SCRIPT", "oui"); 
    281         } else { 
    282                 $template->set_var("COMMAND_START_SCRIPT", "non"); 
     284                $template->set_var("COMMAND_START_SCRIPT", $text{"yes"}); 
     285        } else { 
     286                $template->set_var("COMMAND_START_SCRIPT", $text{"no"}); 
    283287        } 
    284288         
     
    294298                $template->set_var("COMMAND_END_DATE",$database->f(2)); 
    295299        } 
     300 
    296301        $template->set_var("COMMAND_TARGET",$database->f("target")); 
    297302         
    298303        if ($database->f("start_inventory")=="enable") { 
    299                 $template->set_var("COMMAND_START_INVENTORY","oui"); 
    300         } else { 
    301                 $template->set_var("COMMAND_START_INVENTORY","non"); 
     304                $template->set_var("COMMAND_START_INVENTORY",$text{"yes"}); 
     305        } else { 
     306                $template->set_var("COMMAND_START_INVENTORY",$text{"no"}); 
    302307        } 
    303308 
    304309        if ($database->f("wake_on_lan")=="enable") { 
    305                 $template->set_var("COMMAND_WAKE_ON_LAN","oui"); 
    306         } else { 
    307                 $template->set_var("COMMAND_WAKE_ON_LAN","non"); 
     310                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"yes"}); 
     311        } else { 
     312                $template->set_var("COMMAND_WAKE_ON_LAN",$text{"no"}); 
    308313        }        
    309314         
     
    344349SELECT 
    345350        id_command_history, 
    346         DATE_FORMAT(date, '%d-%m-%Y à %H:%i:%s') as date, 
     351        DATE_FORMAT(date, '%d-%m-%Y %H:%i:%s') as date, 
    347352        state, 
    348353        stderr, 
  • trunk/webmin/lsc/connection_error.cgi

    r227 r250  
    4040 
    4141if ($session->ping_error) { 
    42         $template->set_var("PING", "échec"); 
    43         $template->set_var("TEST_SSH", "non testé"); 
    44         $template->set_var("TEST_AUTOFS", "non testé"); 
     42        $template->set_var("PING", $text{"failed"}); 
     43        $template->set_var("TEST_SSH", $text{"not_tested"}); 
     44        $template->set_var("TEST_AUTOFS", $text{"not_tested"}); 
    4545        $template->set_var("SSH_COMMAND", ""); 
    4646        $template->set_var("SSH_RETURN_VAL", ""); 
     
    4848         
    4949} else { 
    50         $template->set_var("PING", "succès"); 
     50        $template->set_var("PING", $text{"success"}); 
    5151        if ($session->error_ssh_failed) { 
    52                 $template->set_var("TEST_SSH", "échec"); 
    53                 $template->set_var("TEST_AUTOFS", "non testé"); 
     52                $template->set_var("TEST_SSH", $text{"failed"}); 
     53                $template->set_var("TEST_AUTOFS", $text{"not_tested"}); 
    5454        } else { 
    55                 $template->set_var("TEST_SSH", "succès"); 
     55                $template->set_var("TEST_SSH", $text{"success"}); 
    5656         
    57                 if ($session->error_autofs_failed) $template->set_var("TEST_AUTOFS", "échec"); 
    58                 else $template->set_var("TEST_AUTOFS", "succès"); 
     57                if ($session->error_autofs_failed) $template->set_var("TEST_AUTOFS", $text{"failed"}); 
     58                else $template->set_var("TEST_AUTOFS", $text{"success"}); 
    5959        } 
    6060 
  • trunk/webmin/lsc/include/command_launcher.inc.php

    r238 r250  
    187187                         
    188188                        // Launch $start_command 
    189                          
    190189                        unset($output);unset($return_var);unset($return_var);unset($stdout);unset($stderr); 
    191190                        lsc_ssh( 
     
    394393                                return; 
    395394                        } 
     395                } 
     396                 
     397                /* No OS detected yet, let's retry */ 
     398                if ($this->command->path_destination == "") { 
     399                        debug(2, "LSC_Command_Launcher->execute: os detect"); 
     400                        $this->session->initialize_os_type(); 
     401                        $this->command->path_destination = $this->session->tmp_path; 
     402                        debug(2, "LSC_Command_Launcher->execute: path=".$this->session->tmp_path); 
    396403                } 
    397404                 
     
    536543                        lsc_command_on_host_set_current_state($this->id_command_on_host, "done"); 
    537544                } 
     545 
     546                /* handle repeats */ 
     547                $this->repeat_resched(); 
    538548        } 
    539549 
     
    551561                 
    552562                $mac = get_mac_address_from_full_hostname($this->command_on_host->host); 
    553                                    
     563                $coh = $this->command_on_host; 
     564                 
    554565                if ( $mac != "" ) { 
    555                         $remains_connection_attempt = lsc_command_on_host_get_remains_connection_attempt($this->id_command_on_host)
     566                        $remains_connection_attempt = $coh->number_attempt_connection_remains
    556567                        while($remains_connection_attempt > 0) { 
    557                                 $this->command_on_host->refresh(); 
    558                                  
    559                                 if ( 
    560                                         ($this->command_on_host->current_state=="stop") || 
    561                                         ($this->command_on_host->current_state=="pause") 
    562                                 ) { 
     568                                $coh->refresh(); 
     569                                 
     570                                if ( ($coh->current_state=="stop") || 
     571                                        ($coh->current_state=="pause")) { 
    563572                                        return 0; 
    564573                                } 
     
    634643                                if ($this->command_on_host->next_launch_date == "0000-00-00 00:00:00") { 
    635644                                        lsc_command_on_host_set_next_launch_date($this->id_command_on_host, date("Y-m-d H:i:s")); 
     645                                }  
     646 
     647                                if ($remains_connection_attempt > 0) { 
     648                                        /* more attempts: schedule a retry */ 
     649                                        $coh->update_next_launch_date( 
     650                                                "next_launch_date + interval ".intval($this->command->next_connection_delay)." minute" 
     651                                        ); 
     652                                } else { 
     653                                        /* no more attempts remaining, check if periodic */ 
     654                                        $this->repeat_resched(); 
    636655                                } 
    637  
    638                                 lsc_command_on_host_adjust_next_launch_date( 
    639                                         $this->id_command_on_host, 
    640                                         "+ interval ".$this->command->next_connection_delay." minute" 
    641                                 ); 
    642  
     656                                 
    643657                                return -1;                                       
    644658                                 
     
    668682        } 
    669683         
     684        /* check if a task is periodic, and reschedule it */ 
     685        function repeat_resched() 
     686        { 
     687                $coh = $this->command_on_host; 
     688                 
     689                if ($this->command->repeat == 0) { 
     690                        return; 
     691                } 
     692                if ($coh->end_date != "0000-00-00 00:00:00") { 
     693                        if (strtotime($coh->end_date) < time()) { 
     694                                /* stop after end date */ 
     695                                return; 
     696                        } 
     697                } 
     698                /* to re-schedule: next_date = start_date + interval */ 
     699                $coh->update_next_launch_date("start_date + interval 30 minute"); 
     700                $coh->start_date = $coh->next_launch_date; 
     701                $coh->number_attempt_connection_remains = $this->command->max_connection_attempt; 
     702                $coh->current_state = "scheduled"; 
     703                $coh->uploaded = "TODO"; 
     704                $coh->executed = "TODO"; 
     705                $coh->deleted = "TODO"; 
     706                $coh->update(); 
     707                /* should set state done if next > end_date */ 
     708        } 
     709         
     710        /* wake on lan */ 
    670711        function wake_on_lan_mac($mac) 
    671712        { 
  • trunk/webmin/lsc/include/commands.inc.php

    r238 r250  
    763763        } 
    764764 
    765         // should we kill the running job if available ? 
    766  
    767         $query = sprintf( 
    768 
    769         UPDATE 
    770                 %s 
    771         SET 
    772                 current_state = \"stop\", 
    773                 current_pid = -1 
    774         WHERE 
    775                 id_command = \"%s\" and 
    776                 ( 
    777                 current_state = \"not_reachable\" or 
    778                 current_state = \"scheduled\" or 
    779                 current_state = \"upload_failed\" or 
    780                 current_state = \"execution_failed\" or 
    781                 current_state = \"delete_failed\" or 
    782                 current_state = \"inventory_failed\" 
    783                 ) 
    784 ", 
    785                 COMMANDS_ON_HOST_TABLE, 
    786                 $id_command 
    787         ); 
    788          
    789         $database->query($query); 
     765        $database->query("SELECT id_command_on_host FROM ".COMMANDS_ON_HOST_TABLE. 
     766                " WHERE id_command = \"$id_command\";"); 
     767         
     768        // stop and kill each job 
     769        while ( $database->next_record() ) { 
     770                lsc_command_on_host_set_stop($database->f("id_command_on_host")); 
     771        } 
     772         
    790773} 
    791774 
  • trunk/webmin/lsc/include/commands_on_host.inc.php

    r238 r250  
    3939        var $deleted;                           /**< is command deleted ? */ 
    4040        var $next_launch_date;                  /**< when this command will be started (YYYY-MM-DD HH:MM:SS) */ 
    41         var $number_attempt_connection_remains; /**< TODO */ 
     41        var $number_attempt_connection_remains; /**< number of attempts */ 
    4242        var $next_attempt_date_time;            /**< php time function value */ 
    4343        var $current_pid = -1; 
     
    401401 
    402402        /** 
     403        * Adjust next launch date 
     404        * 
     405        * @param $id_command_on_host 
     406        * @param new next attempt date time value 
     407        * 
     408        */ 
     409        function update_next_launch_date($date) { 
     410                global $database; 
     411 
     412                $query = sprintf("UPDATE %s 
     413                        SET next_launch_date = %s 
     414                        WHERE id_command_on_host = \"%s\" ", 
     415                        COMMANDS_ON_HOST_TABLE, 
     416                        $date, 
     417                        $this->id_command_on_host 
     418                ); 
     419                 
     420                $database->query($query); 
     421                $this->refresh(); 
     422        } 
     423        /** 
    403424         * Return in array command history of current command on host 
    404425         * 
     
    692713} 
    693714 
    694 /** 
    695  * Adjust next launch date 
    696  * 
    697  * @param $id_command_on_host 
    698  * @param new next attempt date time value 
    699  * 
    700  */ 
    701 function lsc_command_on_host_adjust_next_launch_date($id_command_on_host, $new_date_time) 
    702 { 
    703         global $database, $DEBUG; 
    704  
    705         if (!isset($database)) { 
    706                 $database = new LSC_DB(); 
    707                 if ($DEBUG >= 1) $database->Debug = true; 
    708         } 
    709  
    710         $query = sprintf( 
    711 " 
    712         UPDATE 
    713                 %s 
    714         SET 
    715                 next_launch_date = next_launch_date %s 
    716         WHERE 
    717                 id_command_on_host = \"%s\" 
    718 ", 
    719                 COMMANDS_ON_HOST_TABLE, 
    720                 $new_date_time, 
    721                 $id_command_on_host 
    722         ); 
    723          
    724         $database->query($query); 
    725 } 
    726  
    727715function lsc_command_on_host_set_current_state($id_command_on_host, $new_state) 
    728716{ 
     
    956944                %s 
    957945        SET 
    958                 current_state = \"pause\", 
    959                 current_pid = \"-1\" 
     946                current_state = \"pause\" 
    960947        WHERE 
    961948                id_command_on_host = \"%s\" and 
     
    1003990        $database->next_record(); 
    1004991        $current_state = $database->f("current_state"); 
    1005         if ( 
    1006                 ($current_state == "not_reachable") || 
    1007                 ($current_state == "scheduled") || 
    1008                 ($current_state == "upload_failed") || 
    1009                 ($current_state == "execution_failed") || 
    1010                 ($current_state == "delete_failed") || 
    1011                 ($current_state == "inventory_failed") || 
    1012                 ($current_state == "upload_in_progress") || 
    1013                 ($current_state == "execution_in_progress") || 
    1014                 ($current_state == "delete_in_progress") || 
    1015                 ($current_state == "inventory_in_progress") 
    1016         ) { 
    1017                 if ( $database->f("current_pid") != -1 ) { 
    1018                         posix_kill($database->f("current_pid"), 9); 
    1019                 } 
    1020  
    1021                 $query = sprintf( 
    1022 
     992        if ( ($current_state != "done") ) { 
     993                if ( $database->f("current_pid") > 1 ) { 
     994                        system("./killparent.sh ".$database->f("current_pid")); 
     995                        //posix_kill($database->f("current_pid"), 9); 
     996                } 
     997 
     998                $query = sprintf(" 
    1023999        UPDATE 
    10241000                %s 
     
    10271003                current_pid = \"-1\" 
    10281004        WHERE 
    1029                 id_command_on_host = \"%s\" 
    1030 ", 
     1005                id_command_on_host = \"%s\" ", 
    10311006                        COMMANDS_ON_HOST_TABLE, 
    10321007                        $id_command_on_host 
  • trunk/webmin/lsc/include/exec.inc.php

    r227 r250  
    4848{ 
    4949        $keychain = get_keychain(); 
    50  
    51         $ssh_command ="$keychain ssh -o StrictHostKeyChecking=no -o Batchmode=yes -o PasswordAuthentication=no ".$user."@".$ip." \"".$command."\" 2>&1"; 
    5250         
    53         /* 
    54         exec($ssh_command, $output, $return_var); 
    55         $stdout=""; 
    56         if (count($output)>0) { 
    57                 $separator=""; 
    58                 foreach($output as $line) { 
    59                         $stdout.=$separator.$line; 
    60                         $separator="\n"; 
    61                 } 
    62         } 
    63         */ 
     51        /* -tt forces tty allocation so that signals like SIGINT 
     52        will be properly sent to the remote host */ 
     53        $ssh_command ="$keychain ssh -tt -o StrictHostKeyChecking=no -o Batchmode=yes -o PasswordAuthentication=no ".$user."@".$ip." \"".$command."\" 2>&1"; 
    6454         
    6555        $handle = popen($ssh_command, "r"); 
     
    7666                } 
    7767        } 
    78         pclose($handle); 
    79         $handle = popen ("echo $?", "r"); 
    80         $return_var = fread($handle, 10); 
    81         pclose($handle); 
     68        $return_var = pclose($handle); 
    8269        $stdout = $output; 
    83         $stderr = ""; // TODO 
     70        $stderr = ""; // TODO. Problem: only one stream read with popen 
     71        if ($return_var != 0) $stderr .= "*** Exit code: $return_var ***"; 
    8472        $command = $ssh_command; 
    8573} 
     
    9078function lsc_scp($user, $ip, $source, $destination, &$output, &$return_var, &$stdout, &$stderr, &$scp_command) 
    9179{ 
    92         $opts = "-o Batchmode=yes -o StrictHostKeyChecking=no"; 
     80        $opts = "-o Batchmode=yes -o StrictHostKeyChecking=no -r"; 
    9381 
    9482        $destination = ereg_replace(" ", "\\ ", $destination); 
  • trunk/webmin/lsc/include/file.inc.php

    r227 r250  
    11131113 
    11141114/** 
    1115  * to send file via the POST methode 
     1115 * to send file via the POST method 
    11161116 */ 
    11171117function LSC_fileSend($session, $path) 
  • trunk/webmin/lsc/include/scheduler.inc.php

    r238 r250  
    223223                        "0000-00-00 00:00:00", 
    224224                        "root", 
    225                         $REMOTE_USER
     225                        $REMOTE_USER."@".$_SERVER['REMOTE_ADDR']
    226226                        $desc, 
    227227                        false, 
  • trunk/webmin/lsc/include/ssh.inc.php

    r227 r250  
    118118                /* safe defaults */ 
    119119                $this->root_path = CYGWIN_WINDOWS_ROOT_PATH; 
    120                 $this->tmp_path = $this->root_path."/c/lsc"; 
    121                  
    122                 /* Initialise mac adress */ 
     120                $this->tmp_path = $config['path_destination'];; 
     121                debug(1, sprintf("Default path : '%s'", $this->tmp_path)); 
     122                 
     123                /* Initialize mac address */ 
    123124                $this->mac = $mac; 
    124                 debug(1, sprintf("Mac adress : '%s'", $mac)); 
     125                debug(1, sprintf("Mac address : '%s'", $mac)); 
    125126 
    126127                /* Load ether file */ 
     
    187188                         $ls_command = "ls ".MOUNT_EXPLORER."/".$this->user."@".$this->ip."/"; 
    188189                          
    189                          lsc_ssh( 
    190                                 $this->user,  
    191                                 $this->ip,  
     190                         lsc_exec( 
    192191                                $ls_command,  
    193192                                $this->ssh_array_output,  
     
    208207                 } 
    209208                 
    210                 /* Set connection user home path */ 
    211                 if ($home == "") { 
     209                /* Set connection user home path. Not Used */ 
     210                /* if ($home == "") { 
    212211                        $this->home = $this->LSC_getHomePath(); 
    213212                } else { 
    214213                        $this->home = $home; 
    215                 } 
     214                }*/ 
    216215                 
    217216                debug(1, sprintf("User home path : %s", $this->home)); 
     
    399398        function initialize_os_type($known_type = "") 
    400399        { 
     400                global $config; 
     401                 
    401402                $random = mt_rand(); 
    402403                if ($known_type === false) { 
     
    405406                if ($known_type == "") { 
    406407                        unset($output); unset($return_var); unset($stdout); unset($stderr); 
    407                         lsc_exec("xprobe2 -M 6 ".$this->ip." 2>&1", $output, $return_var, $stdout, $stderr); 
     408                        lsc_exec("./xprobe_safe ".$this->ip, $output, $return_var, $stdout, $stderr); 
    408409                        $key = LSC_arrayEreg("Running OS", $output); 
    409410                        $type = $output[$key]; 
     
    411412                        $type = $known_type; 
    412413                } 
     414                debug(2, "OS Type:".$type); 
    413415                if ( strpos ( $type, "Windows" ) !== FALSE) { 
    414416                        $this->platform = "Windows"; 
     417                        $this->tmp_path = $config[path_destination]; 
    415418                        return; 
    416419                } elseif ( strpos ( $type, "Linux" ) !== FALSE) { 
     
    420423                        return; 
    421424                } 
    422                 $this->platform = "Other";      // keep the default root path in case it's a windows system 
     425                $this->platform = "Other/N.A."; 
     426                $this->tmp_path = ""; 
    423427        } 
    424428 
  • trunk/webmin/lsc/include/widget.inc.php

    r227 r250  
    457457        )); 
    458458 
    459         $template->set_block("widget_standard_host_actions", "SCRIPT_LIST", "rows"); 
     459        $template->set_block("widget_standard_host_actions", "SCRIPT_LIST", "rows_ha"); 
    460460        foreach( $script_list as $script ) { 
    461461                $template->set_var("FILENAME", $script["filename"]); 
    462462                $template->set_var("TITLE", isset($script["title".$lang]) ? $script["title".$lang] : $script["title"]); 
    463                 $template->parse("rows", "SCRIPT_LIST", true); 
     463                $template->parse("rows_ha", "SCRIPT_LIST", true); 
    464464        } 
    465465 
     
    604604         
    605605        if ($command->create_directory_enable) { 
    606                 $template->set_var("COMMAND_CREATE_DIRECTORY", "Activé"); 
    607         } else { 
    608                 $template->set_var("COMMAND_CREATE_DIRECTORY", "Désactivé"); 
     606                $template->set_var("COMMAND_CREATE_DIRECTORY", "Activ?"); 
     607        } else { 
     608                $template->set_var("COMMAND_CREATE_DIRECTORY", "D?sactiv?"); 
    609609        } 
    610610         
    611611        if ($command->start_script_enable) { 
    612                 $template->set_var("COMMAND_START_SCRIPT", "Activé"); 
    613         } else { 
    614                 $template->set_var("COMMAND_START_SCRIPT", "Désactivé"); 
     612                $template->set_var("COMMAND_START_SCRIPT", "Activ?"); 
     613        } else { 
     614                $template->set_var("COMMAND_START_SCRIPT", "D?sactiv?"); 
    615615        } 
    616616         
     
    944944         
    945945        if ($command->create_directory_enable) { 
    946                 $template->set_var("COMMAND_CREATE_DIRECTORY", "Activé"); 
    947         } else { 
    948                 $template->set_var("COMMAND_CREATE_DIRECTORY", "Désactivé"); 
     946                $template->set_var("COMMAND_CREATE_DIRECTORY", "Activ?"); 
     947        } else { 
     948                $template->set_var("COMMAND_CREATE_DIRECTORY", "D?sactiv?"); 
    949949        } 
    950950         
    951951        if ($command->start_script_enable) { 
    952                 $template->set_var("COMMAND_START_SCRIPT", "Activé"); 
    953         } else { 
    954                 $template->set_var("COMMAND_START_SCRIPT", "Désactivé"); 
     952                $template->set_var("COMMAND_START_SCRIPT", "Activ?"); 
     953        } else { 
     954                $template->set_var("COMMAND_START_SCRIPT", "D?sactiv?"); 
    955955        } 
    956956         
  • trunk/webmin/lsc/lang/en

    r227 r250  
    5757success=success 
    5858failed=failed 
     59not_tested=not tested 
  • trunk/webmin/lsc/lang/fr

    r227 r250  
    5757success=succès 
    5858failed=échoué 
     59not_tested=pas testé 
  • trunk/webmin/lsc/open_session.inc.php

    r227 r250  
    1414         * Open the session 
    1515         */ 
     16                 
    1617        if ($_COOKIE["session"][$getmac]["platform"]!="") { 
    1718                $session = new LSC_Session( 
     
    2324                ); 
    2425        } else { 
    25                 $session = new LSC_Session($getmac, "root", !$isgroup); 
     26                $ping_enable = !$isgroup; 
     27                if (strstr($_SERVER['REQUEST_URI'], "repository.cgi")) $ping_enable = false; 
     28                $session = new LSC_Session($getmac, "root", $ping_enable); 
    2629        } 
    2730         
  • trunk/webmin/lsc/repository.cgi

    r227 r250  
    246246         
    247247        foreach($_POST["select_to_copy"] as $i) { 
    248                 $item=$_POST["filename"][$i]; 
    249                 if (is_dir($path_source."/".$item)) { 
    250                         $files = array_merge( 
    251                                 $files, 
    252                                 return_all_files_of_directory_recursive( 
    253                                         $path_source."/".$item,  
    254                                         $item."/" 
    255                                 ) 
    256                         ); 
    257                 } else { 
    258                         array_push($files, $item); 
    259                 } 
     248                // push files even if they are directories since they will  
     249                // be uploaded with a 'scp -r' 
     250                $item = $_POST["filename"][$i]; 
     251                array_push($files, $item); 
    260252                if ( $_POST["select_to_execute"] == $i ) { 
    261253                        $start_file = $item;