Various fixes to support module install for the default version

This commit is contained in:
Jamie Cameron
2024-11-29 17:07:02 -08:00
parent 08b1ee3be6
commit 797ba9f45e
3 changed files with 23 additions and 19 deletions

View File

@@ -41,16 +41,20 @@ foreach my $pkg (@poss) {
my @pinfo = &software::package_info($pkg);
if (@pinfo) {
print $text{'imod_already'},"<p>\n";
$ok = 1;
last;
next;
}
my ($out, $rs) = &capture_function_output(
\&software::update_system_install, $pkg);
my @pinfo = &software::package_info($pkg);
if (@pinfo && @$rs) {
print $text{'imod_done'},"<p>\n";
$ok = 1;
last;
($got) = grep { $_->{'mod'} eq $in{'mod'} }
&list_php_ini_modules($inidir);
if ($got) {
print $text{'imod_done'},"<p>\n";
$ok = 1;
last;
}
print $text{'imod_missing'},"<p>\n";
}
print $text{'imod_failed'},"<p>\n";
}
@@ -58,14 +62,7 @@ if (!$ok) {
print "<b>$text{'imod_allfailed'}</b><p>\n";
}
else {
($got) = grep { $_->{'mod'} eq $in{'mod'} }
&list_php_ini_modules($inidir);
if ($got) {
print "<b>$text{'imod_alldone'}</b><p>\n";
}
else {
print "<b>$text{'imod_allmissing'}</b><p>\n";
}
print "<b>$text{'imod_alldone'}</b><p>\n";
}
&ui_print_footer("edit_mods.cgi?file=".&urlize($in{'file'}),

View File

@@ -191,12 +191,12 @@ imod_err=Failed to install PHP module
imod_emod=No PHP module entered
imod_trying=Installing package $1 ..
imod_done=.. installed successfully!
imod_already=.. not needed, as package is already installed
imod_already=.. already installed, but does not provide the PHP module
imod_failed=.. install failed
imod_allfailed=No software packages for the specified PHP module could be installed.
imod_alreadygot=PHP module $1 is already installed
imod_alldone=The PHP module was successfully installed and is now available for use.
imod_allmissing=Package installation completed, but the PHP module was not detected.
imod_missing=.. install completed, but the PHP module was not detected.
log_manual=Manually edit file $1
log_vars=Changed PHP variables in $1

View File

@@ -348,6 +348,7 @@ if ($file =~ /^php.*?([\d\.]+)$/) {
&has_command("php$nodot");
return $binary if ($binary);
}
return $ver ? undef : &has_command("php");
}
@@ -374,7 +375,10 @@ if ($file =~ /^php.*?([\d\.]+)$/) {
$ver =~ s/^(\d)(\d+)$/$1.$2/;
return $ver;
}
return undef;
# The php.ini has no version in the filename, so try to get the version from
# the default php binary
return &get_php_binary_version($file);
}
# get_php_binary_version(file|version-string)
@@ -393,8 +397,10 @@ my ($file) = @_;
my $phpbinary = &get_php_ini_binary($file || $in{'file'});
return undef if (!$phpbinary);
my $phpver = &backquote_command("$phpbinary -v 2>&1");
($phpver) = $phpver =~ /^PHP\s+([\d\.]+)/;
return $phpver;
if ($phpver =~ /(^|\n)PHP\s+([\d\.]+)/) {
return $2;
}
return undef;
}
# php_version_test_against(version, comparison-operator, [file|version-string])
@@ -683,9 +689,10 @@ foreach my $f (readdir(DIR)) {
};
my $lref = &read_file_lines($path, 1);
foreach my $l (@$lref) {
if ($l =~ /^\s*(;?)\s*extension\s*=\s*(\S+)(\.so)?/) {
if ($l =~ /^\s*(;?)\s*extension\s*=\s*(\S+(\.so)?)/) {
$ini->{'enabled'} = $1 ? 0 : 1;
$ini->{'mod'} = $2;
$ini->{'mod'} =~ s/\.so$//;
}
}
push(@rv, $ini);