diff --git a/mysql/index.cgi b/mysql/index.cgi index cc348cfce..50f32ed4d 100755 --- a/mysql/index.cgi +++ b/mysql/index.cgi @@ -317,70 +317,17 @@ else { print &ui_buttons_end() if ($started_buttons_row); # Check if the optional perl modules are installed - my @needs; - my %pkgmap = ( - 'DBI' => [ 'perl-DBI', 'libdbi-perl' ], - 'DBD::mysql' => [ 'perl-DBD-MySQL', 'libdbd-mysql-perl' ], - 'DBD::MariaDB' => [ 'perl-DBD-MariaDB', 'libdbd-mariadb-perl' ], - ); - my ($mysql_ver, $mysql_variant) = &get_remote_mysql_variant(); - my $want_driver = $mysql_variant eq 'mariadb' - ? 'DBD::MariaDB' - : 'DBD::mysql'; - my @mods_to_check = ('DBI', $want_driver); - for my $mod (@mods_to_check) { - next if (!exists $pkgmap{$mod}); - eval "require $mod; 1" or push @needs, $mod; - } - if (@needs) { - my $return = "../$module_name/"; - my $returndesc = $text{'index_return'}; - - # If CPAN module is available, use it - if (&foreign_available("cpan")) { - my $needs_q = &urlize(join(" ", @needs)); - print &ui_alert_box( - &text(@needs == 2 - ? 'index_nomods' - : 'index_nomod', - @needs, - "../cpan/download.cgi?source=3&cpan=". - "$needs_q&mode=2&return=/$module_name/". - "&returndesc=". - &urlize($returndesc)), - 'warn'); - } - - # If no CPAN, try system packages via software module - elsif (foreign_available("software")) { - &foreign_require("software"); - my $return = "../$module_name/"; - my $returndesc = $text{'index_title'}; - - # Resolve one package per missing module, for this OS - my @want_pkgs; - for my $mod (@needs) { - for my $cand (@{ $pkgmap{$mod} }) { - my ($pkg, $flags) = - &software::update_system_resolve( - $cand); - if ($pkg) { - push @want_pkgs, $cand; - last; - } - } - } - if (@want_pkgs) { - my $desc = &text(@want_pkgs > 1 - ? 'index_nomods2' - : 'index_nomod2', @needs); - my $link = &software::missing_install_link( - join(' ', @want_pkgs), - $desc, - $return, - $returndesc); - print &ui_alert_box($link, 'warn'); - } + if (foreign_available("cpan")) { + eval "use DBI"; + push(@needs, "DBI") if ($@); + $nodbi++ if ($@); + eval "use DBD::mysql"; + push(@needs, "DBD::mysql") if ($@); + if (@needs) { + $needs = &urlize(join(" ", @needs)); + print &ui_alert_box(&text(@needs == 2 ? 'index_nomods' : 'index_nomod', @needs, + "../cpan/download.cgi?source=3&cpan=$needs&mode=2&return=/$module_name/&returndesc=". + &urlize($text{'index_return'})), 'warn'); } } } diff --git a/mysql/lang/en b/mysql/lang/en index fa27f7d2c..d76619928 100644 --- a/mysql/lang/en +++ b/mysql/lang/en @@ -30,8 +30,6 @@ index_version=$2 version $1 index_version2=$3 version $1 on $2 index_nomod=The Perl module $1 is not installed on your system, so Webmin will not be able to reliably access your MySQL database. Click here to install it now. index_nomods=The Perl modules $1 and $2 are not installed on your system, so Webmin will not be able to reliably access your MySQL database. Click here to install them now. -index_nomod2=module $1 is not available on your system for Webmin to reliably access your MySQL database but -index_nomods2=modules $1 and $2 are not available on your system for Webmin to reliably access your MySQL database but index_mysqlver=The command $1 returned : index_eenvpass=The MySQL client program $1 does not accept passwords passed using the MYSQL_PWD environment variable. To ensure that Webmin is able to fully communicate with MySQL, this option should be turned off on the module configuration page. Alternately, you can remove any password set in the root user's .my.cnf file. index_ecnf=The MySQL config file $1 was not found on your system. Use the module configuration page to set the correct path. diff --git a/software/lang/en b/software/lang/en index ae0a474f0..ac1bb3398 100644 --- a/software/lang/en +++ b/software/lang/en @@ -397,7 +397,7 @@ csw_form=Upgrade Packages csw_upgrade=Upgrade All Installed Packages csw_updatedesc=Upgrading all installed packages with command $1 .. -missing_msg=The $1 can be automatically installed using package manager. +missing_msg=The $1 package can be automatically installed by Webmin using $2. missing_now=Install Now find_title=Search For Package diff --git a/software/software-lib.pl b/software/software-lib.pl index 225606d97..e3a5d2955 100755 --- a/software/software-lib.pl +++ b/software/software-lib.pl @@ -254,24 +254,15 @@ sub missing_install_link local ($name, $desc, $return, $returndesc) = @_; return undef if (!defined(&update_system_resolve)); return undef if (!&foreign_check($module_name)); -my @packages = split(/\s+/, $name); -my (@pkgs, @flags); -foreach my $p (@packages) { - my ($pkg, $flags) = &update_system_resolve($p); - push(@pkgs, $pkg); - push(@flags, $flags); - } -return undef if (!@pkgs); -@pkgs = &unique(@pkgs); -my $hidden_update = join("", map { &ui_hidden("update", $_) } @pkgs); -@flags = &unique(@flags); +local ($pkg, $flags) = &update_system_resolve($name); +return undef if (!$pkg); local ($cpkg) = caller(); local $caller = eval '$'.$cpkg.'::module_name'; return &ui_form_start("@{[&get_webprefix()]}/$module_name/install_pack.cgi", "get"). &text('missing_msg', $desc, $text{$update_system."_name"})."\n". &ui_hidden("source", 3). - $hidden_update. - &ui_hidden("flags", join(" ", @flags)). + &ui_hidden("update", $pkg). + &ui_hidden("flags", $flags). &ui_hidden("return", $return). &ui_hidden("returndesc", $returndesc). &ui_hidden("caller", $caller).