Skip to content

Commit

Permalink
Offer php module only if php can be found in repos
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Aug 9, 2022
1 parent 8c86ba1 commit d02a51b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions src/modules/YaPI/HTTPDModules.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use YaPI;
use YaST::HTTPDPhpModule;

textdomain "http-server";

$php_version = YaST::HTTPDPhpModule->Version();
%modules = (
# (without_leading mod_) module name = {
# summary => __("Translatable text with module description - will be shown in YaST table"),
Expand Down Expand Up @@ -708,12 +710,6 @@ textdomain "http-server";
{ option =>"VirtualScriptAliasIP", "context" => [ "Server", "Virtual", "Directory" ] }
]
},
'php' . YaST::HTTPDPhpModule->Version() => {
summary => __("Provides support for PHP dynamically generated pages"),
packages => ["apache2-mod_php" . YaST::HTTPDPhpModule->Version()],
default => 0,
position => 490
},
'perl' => {
summary => __("Provides support for Perl dynamically generated pages"),
packages => ["apache2-mod_perl"],
Expand Down Expand Up @@ -768,6 +764,19 @@ textdomain "http-server";
}

);

if($php_version)
{
%modules = ( %modules,
'php' . $php_version => {
summary => __("Provides support for PHP dynamically generated pages"),
packages => ["apache2-mod_php" . YaST::HTTPDPhpModule->Version()],
default => 0,
position => 490
}
);
}

%selection = (
TestSel => {
summary => 'A test selection',
Expand Down
2 changes: 1 addition & 1 deletion src/modules/YaST/HTTPDPhpModule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sub Version {
# when function returns an array, we get reference to it
$l = Package->by_pattern("php[0-9]{1,2}");

return "" if(!$l);
return if(!$l);

# there can be multiple versions of php and
# package name is php<version>. We're interested in <version> only
Expand Down

0 comments on commit d02a51b

Please sign in to comment.