diff --git a/CHANGELOG.md b/CHANGELOG.md index e02c15d7b..5a3894ea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,18 @@ ## Changelog -#### 2.400 (May 24, 2025) -* Added built-in support for forgotten password recovery -* Fixed bugs with IPv6 interface creation on systems using Network Manager -* Improved security of single-use login links -* Added support for SSL certificates and DNS over TLS in the BIND module +#### 2.400 (May 25, 2025) +* Add built-in support for forgotten password recovery +* Add support for SSL certificates and DNS over TLS in the BIND module +* Add support to configure listen for any type of address in Dovecot module +* Add display of the PHP binary and its version in the PHP Configuration module +* Add TOML as editable format in the File Manager module +* Add support for template variables in help pages +* Improve security of single-use login links +* Fix Linux systems to show human-readable timestamps in the System Logs module +* Fix to prefer JSON::XS over JSON::PP if available for better performance +* Fix bugs with IPv6 interface creation on systems using Network Manager +* Fix to address the security issue in the System Documentation module + #### 2.303 (March 14, 2025) * Fix permissions error when attempting to open a temp file for writing diff --git a/phpini/delete_pkgs.cgi b/phpini/delete_pkgs.cgi index c15fc324e..4e273d065 100755 --- a/phpini/delete_pkgs.cgi +++ b/phpini/delete_pkgs.cgi @@ -12,7 +12,7 @@ my @d = split(/\0/, $in{'d'}); my $vmap = &get_virtualmin_php_map(); # Find all packages and check that they can be safely removed -my @pkgs = &list_php_base_packages(); +my @pkgs = &list_any_php_base_packages(); my @delpkgs; foreach my $name (@d) { ($pkg) = grep { $_->{'name'} eq $name } @pkgs; diff --git a/phpini/list_pkgs.cgi b/phpini/list_pkgs.cgi index e8919e605..7897079e1 100755 --- a/phpini/list_pkgs.cgi +++ b/phpini/list_pkgs.cgi @@ -7,7 +7,7 @@ $access{'global'} || &error($text{'pkgs_ecannot'}); &ui_print_header(undef, $text{'pkgs_title'}, ""); -my @pkgs = &list_php_base_packages(); +my @pkgs = &list_any_php_base_packages(); my %got; if (@pkgs) { my $vmap = &get_virtualmin_php_map(); @@ -51,13 +51,21 @@ else { print "$text{'pkgs_none'}
\n"; } -if (&foreign_installed("package-updates")) { +my @newpkgs = grep { !$got{$_->{'name'}} } &list_any_available_php_packages(); +if (@newpkgs && &foreign_installed("package-updates")) { # Show form to install a new version - @newpkgs = grep { !$got{$_->{'name'}} } &list_available_php_packages(); print &ui_hr(); print &ui_form_start( &get_webprefix()."/package-updates/update.cgi", "post"); print "$text{'pkgs_newver'} \n"; + # Always install -cli package, along with the common package + foreach my $pkg (@newpkgs) { + if ($pkg->{'name'} =~ /-common$/) { + my $pkg_cli = $pkg->{'name'}; + $pkg_cli =~ s/-common$/-cli/; + $pkg->{'name'} .= " $pkg_cli"; + } + } print &ui_select("u", undef, [ map { [ $_->{'name'}, "PHP $_->{'shortver'}" ] } @newpkgs ]); diff --git a/phpini/phpini-lib.pl b/phpini/phpini-lib.pl index ed661a495..6ffd103f2 100755 --- a/phpini/phpini-lib.pl +++ b/phpini/phpini-lib.pl @@ -866,7 +866,7 @@ else { return @poss; } -# list_php_base_packages() +# list_php_base_packages([common]) # Returns a list of hash refs, one per PHP version installed, with the # following keys : # name - Package name @@ -875,13 +875,19 @@ return @poss; # phpver - PHP version sub list_php_base_packages { +my ($common) = @_; &foreign_require("software"); my $n = &software::list_packages(); my @rv; my %done; for(my $i=0; $i<$n; $i++) { my $name = $software::packages{$i,'name'}; - next if ($name !~ /^(php\d*)(-php|-runtime)?$/); + if ($common) { + next if ($name !~ /^(php(?:\d+(?:\.\d+)?)?(?:-php)?-common)$/); + } + else { + next if ($name !~ /^php(\d*)$/); + } $name = $1; my $phpver = $software::packages{$i,'version'}; $phpver =~ s/\-.*$//; @@ -914,19 +920,33 @@ for(my $i=0; $i<$n; $i++) { return sort { &compare_version_numbers($a->{'ver'}, $b->{'ver'}) } @rv; } +# list_any_php_base_packages() +# Returns a list of all PHP base packages, either common or full, +# sorted by version number. If no common packages are available, the +# full PHP packages are used instead, mainly for non-Linux systems +sub list_any_php_base_packages +{ +my @rv = &list_php_base_packages(1); +if (!@rv) { + # If no common packages, then use the full PHP packages + @rv = &list_php_base_packages(); + } +return sort { &compare_version_numbers($a->{'ver'}, $b->{'ver'}) } @rv; +} + # list_all_php_module_packages(base-package) # Returns all install packages for PHP extensions of a given base package sub list_all_php_module_packages { my ($base) = @_; -$base =~ s/(-php|-runtime)$//; +$base =~ s/-common$//; my @rv; &foreign_require("software"); my $n = &software::list_packages(); for(my $i=0; $i<$n; $i++) { my $name = $software::packages{$i,'name'}; next if ($name !~ /^\Q$base\E-/); - push(@rv, { 'name' => $software::packages{$i,'name'}, + push(@rv, { 'name' => $name, 'system' => $software::packages{$i,'system'}, 'ver' => $software::packages{$i,'version'}, }); @@ -934,7 +954,7 @@ for(my $i=0; $i<$n; $i++) { return @rv; } -# list_available_php_packages() +# list_available_php_packages([common]) # Returns a list of hash refs, one per PHP version available, with the # following keys : # name - Package name @@ -942,15 +962,23 @@ return @rv; # phpver - PHP version sub list_available_php_packages { +my ($common) = @_; &foreign_require("package-updates"); my @rv; foreach my $pkg (&package_updates::list_available()) { my $name = $pkg->{'name'}; - next if ($name !~ /^php(\d*)$/); + if ($common) { + next if ($name !~ /^(php(?:\d+(?:\.\d+)?)?(?:-php)?-common)$/); + } + else { + next if ($name !~ /^php(\d*)$/); + } my $phpver = $pkg->{'version'}; $phpver =~ s/\-.*$//; my $shortver = $phpver; $shortver =~ s/^(\d+\.\d+).*$/$1/; + # Avoid overwriting system PHP provided by default repositories + next if (grep { $_->{'shortver'} eq $shortver } @rv); if ($shortver =~ /^5\./) { $shortver = "5"; } @@ -963,6 +991,20 @@ foreach my $pkg (&package_updates::list_available()) { return sort { &compare_version_numbers($a->{'ver'}, $b->{'ver'}) } @rv; } +# list_any_available_php_packages() +# Returns a list of all available PHP packages, either common or standard, +# sorted by version number. If no common packages are available, the +# full PHP packages are used instead, mainly for non-Linux systems +sub list_any_available_php_packages +{ +my @rv = &list_available_php_packages(1); +if (!@rv) { + # If no common packages, then use the full PHP packages + @rv = &list_available_php_packages(); + } +return sort { &compare_version_numbers($a->{'ver'}, $b->{'ver'}) } @rv; +} + # get_virtualmin_php_map() # Return a hash mapping PHP versions like 5 or 7.2 to a list of domains, or # undef if Virtualmin isn't installed @@ -992,8 +1034,8 @@ my ($pkg) = @_; my @rv = map { $_->{'name'} } &list_all_php_module_packages($pkg->{'name'}); my $base = $pkg->{'name'}; -$base =~ s/-php$//; -my @poss = ( @modpkgs, $base."-php", $base."-runtime", $base ); +$base =~ s/-common$//; +my @poss = ( $base."-runtime", $base ); foreach my $p (@poss) { my @info = &software::package_info($p, $pkg->{'ver'}); next if (!@info);