\n"; # Do each server that has it foreach $sinfo (@sinfos) { $d = $sinfo->{'dom'}; &$first_print(&text('massscript_doing', &show_domain_name($d), $sinfo->{'version'}, $sinfo->{'desc'})); &$indent_print(); # Fetch needed files my %gotfiles; $ferr = &fetch_script_files($script, $sinfos[0]->{'dom'}, $ver, $sinfos[0]->{'opts'}, $sinfos[0], \%gotfiles, 1); if ($ferr) { &$outdent_print(); &$second_print(&text('massscript_efetch', $ferr)); next; } $opts = $sinfo->{'opts'}; if (&compare_versions($sinfo->{'version'}, $ver, $script) >= 0) { # Already got it &$outdent_print(); &$second_print(&text('massscript_ever', $sinfo->{'version'})); next; } # Install needed packages &setup_script_packages($script, $d, $ver); # Get locks &obtain_lock_web($d); &obtain_lock_cron($d); # Check if we have PHP local $phpver; if (&indexof("php", @{$script->{'uses'}}) >= 0) { ($phpver, $phperr) = &setup_php_version( $d, $script, $ver, $opts->{'path'}); if (!$phpver) { &$second_print($phperr); next; } } if ($derr = &check_script_depends($script, $d, $ver, $sinfo, $phpver)) { # Failed depends &$second_print(&text('massscript_edep', $derr)); next; } # Install needed PHP/perl/ruby modules &setup_script_requirements($d, $script, $ver, $phpver, $opts) || next; # Work out login and password $domuser = $sinfo->{'user'} || $d->{'user'}; $dompass = $sinfo->{'pass'} || $d->{'pass'}; # Go ahead and do it ($ok, $msg, $desc, $url) = &{$script->{'install_func'}}( $d, $ver, $sinfo->{'opts'}, \%gotfiles, $sinfo, $domuser, $dompass); print $msg,"\n"; &$outdent_print(); &release_lock_web($d); &release_lock_cron($d); if ($ok) { # Worked .. record it &$second_print($text{'setup_done'}); &remove_domain_script($d, $sinfo); &add_domain_script($d, $sname, $ver, $sinfo->{'opts'}, $desc, $url, $sinfo->{'user'}, $sinfo->{'pass'}); } else { &$second_print($text{'scripts_failed'}); last if ($in{'fail'}); } # Clean up any temp files from this script &cleanup_tempnames(); } &run_post_actions(); &webmin_log("upgrade", "scripts", scalar(@sinfos)); } else { # Tell the user which domains will be done, and let him select # Build table data @table = ( ); foreach my $sinfo (@sinfos) { $path = $sinfo->{'opts'}->{'path'}; $utype = &indexof($sinfo->{'version'}, @{$script->{'versions'}}) > 0 ? $text{'massscript_upgrade'} : $text{'massscript_update'}; push(@table, [ { 'type' => 'checkbox', 'name' => 'servers', 'value' => $sinfo->{'dom'}->{'id'}, 'checked' => 1 }, &show_domain_name($sinfo->{'dom'}), $sinfo->{'version'}, $sinfo->{'url'} ? "$path" : $path, $utype, ]); } # Output the table of scripts print &text('massscript_rusure', $script->{'desc'}, $ver),"
\n"; print &ui_form_columns_table( "mass_scripts.cgi", [ [ "confirm", $text{'massscript_ok'} ] ], 0, undef, [ [ "script", $sname." ".$ver ] ], [ "", $text{'massscript_dom'}, $text{'massscript_ver'}, $text{'massscript_path'}, $text{'massscript_utype'} ], 100, \@table, ); } &ui_print_footer("", $text{'index_return'});