Fix to allow installing PHP packages when none installed

This commit is contained in:
Ilia Ross 2025-05-26 02:28:31 +03:00
parent eac8684eb2
commit d88c35bf6f
No known key found for this signature in database
GPG Key ID: 121E166DD9C821AB
2 changed files with 18 additions and 6 deletions

View File

@ -3,25 +3,35 @@
require './phpini-lib.pl';
# Get install button
my $install_button = &show_php_install_button();
# Do we have PHP installed?
my @pkgs = &list_php_base_packages();
if (!@pkgs && $install_button) {
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
&ui_print_endpage($text{'pkgs_none2'}."<br>".$install_button);
}
# Get editable files
@files = &list_php_configs();
if (!@files) {
# User doesn't have access to any
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
&ui_print_endpage("$text{'index_eaccess'}<br>".
&show_php_install_button());
&ui_print_endpage($text{'index_eaccess'}."<br>".
$install_button);
}
@files = grep { -r $_->[0] } @files;
if (!@files) {
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
if ($access{'noconfig'}) {
&ui_print_endpage("$text{'index_efiles'}<br>".
&show_php_install_button());
&ui_print_endpage($text{'index_efiles'}."<br>".
$install_button);
}
else {
&ui_print_endpage(&text('index_efiles2',
"../config.cgi?$module_name")."<br>".
&show_php_install_button());
$install_button);
}
}
@ -74,9 +84,10 @@ else {
# Returns a button to install new PHP versions
sub show_php_install_button
{
&load_theme_library();
my $rv = '';
if ($access{'global'} && &foreign_available("software")) {
$rv = &ui_hr();
$rv .= &ui_hr();
$rv .= &ui_buttons_start();
$rv .= &ui_buttons_row("list_pkgs.cgi",
$text{'index_pkgs'},

View File

@ -226,6 +226,7 @@ pkgs_shortver=Short version
pkgs_users=Used by
pkgs_delete=Delete Selected Packages
pkgs_none=No PHP packages were found on your system!
pkgs_none2=No PHP versions were found on your system. Click the button below to install one, if available in your software package repository.
pkgs_ecannot=You are not allowed to manage PHP packages!
pkgs_ecannot2=Software packages cannot be managed on this system
pkgs_nousers=No domains