From d88c35bf6f97ad4be13c68bee5c3709c96c2750f Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 26 May 2025 02:28:31 +0300 Subject: [PATCH] Fix to allow installing PHP packages when none installed --- phpini/index.cgi | 23 +++++++++++++++++------ phpini/lang/en | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/phpini/index.cgi b/phpini/index.cgi index d9311d5f6..00aa73312 100755 --- a/phpini/index.cgi +++ b/phpini/index.cgi @@ -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'}."
".$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'}
". - &show_php_install_button()); + &ui_print_endpage($text{'index_eaccess'}."
". + $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'}
". - &show_php_install_button()); + &ui_print_endpage($text{'index_efiles'}."
". + $install_button); } else { &ui_print_endpage(&text('index_efiles2', "../config.cgi?$module_name")."
". - &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'}, diff --git a/phpini/lang/en b/phpini/lang/en index 8dc7cbf3b..ffad4c04d 100644 --- a/phpini/lang/en +++ b/phpini/lang/en @@ -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