mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Start of work on being able to select PHP modules
This commit is contained in:
BIN
gray-theme/phpini/images/mods.gif
Normal file
BIN
gray-theme/phpini/images/mods.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
phpini/images/mods.gif
Normal file
BIN
phpini/images/mods.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 592 B |
@@ -170,6 +170,8 @@ disable_leftover=Other functions:
|
||||
disable_err=Failed to save disabled features
|
||||
disable_classes=Disabled built-in classes
|
||||
|
||||
mods_title=PHP Modules
|
||||
|
||||
log_manual=Manually edit file $1
|
||||
log_vars=Changed PHP variables in $1
|
||||
log_dirs=Changed directory settings in $1
|
||||
|
||||
@@ -11,13 +11,15 @@ $in{'file'} =~ /^\// || &error($text{'list_efile'});
|
||||
if (@files == 1 && !$access{'anyfile'} && $access{'noconfig'}) {
|
||||
$onefile = 1;
|
||||
}
|
||||
$inidir = &get_php_ini_dir($in{'file'});
|
||||
|
||||
&ui_print_header("<tt>".&html_escape($in{'file'})."</tt>",
|
||||
$text{'list_title'}, "", undef, 0, $onefile);
|
||||
|
||||
@pages = ( "vars", "dirs", "db", "session", "limits",
|
||||
"errors", "disable", "misc" );
|
||||
push(@pages, 'manual') if ($access{'manual'} ne '0');
|
||||
push(@pages, "manual") if ($access{'manual'} ne '0');
|
||||
push(@pages, "mods") if ($inidir);
|
||||
@links = map { "edit_${_}.cgi?file=".&urlize($in{'file'})."&oneini=1" } @pages;
|
||||
@titles = map { $text{$_."_title"} } @pages;
|
||||
@icons = map { "images/$_.gif" } @pages;
|
||||
|
||||
@@ -285,6 +285,16 @@ my %done;
|
||||
return grep { !$done{$_->[0]}++ } @rv;
|
||||
}
|
||||
|
||||
# get_php_ini_dir(file)
|
||||
# Given a file like /etc/php.ini, return the include directory for additional
|
||||
# .ini files that load modules, like /etc/php.d
|
||||
sub get_php_ini_dir
|
||||
{
|
||||
my ($file) = @_;
|
||||
$file =~ s/\/php.ini$/\/php.d/;
|
||||
return -d $file ? $file : undef;
|
||||
}
|
||||
|
||||
# get_php_ini_binary(file)
|
||||
# Given a php.ini path, try to guess the PHP command for it
|
||||
# Examples:
|
||||
@@ -630,5 +640,32 @@ sub list_known_disable_functions
|
||||
return ( "exec", "passthru", "shell_exec", "system", "proc_open", "popen", "curl_exec", "curl_multi_exec", "parse_ini_file", "show_source", "mail" );
|
||||
}
|
||||
|
||||
# list_php_ini_modules(dir)
|
||||
# Returns a list of hash refs with details of PHP module include files in
|
||||
# a directory
|
||||
sub list_php_ini_modules
|
||||
{
|
||||
my ($dir) = @_;
|
||||
my @rv;
|
||||
opendir(DIR, $dir);
|
||||
foreach my $f (readdir(DIR)) {
|
||||
next if ($f !~ /\.ini$/);
|
||||
my $path = "$dir/$f";
|
||||
my $ini = { 'file' => $f,
|
||||
'path' => $path,
|
||||
};
|
||||
my $lref = &read_file_lines($path, 1);
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /^\s*(;?)\s*extension\s*=\s*(\S+)\.so/) {
|
||||
$ini->{'enabled'} = !$1;
|
||||
$ini->{'ext'} = $2;
|
||||
}
|
||||
}
|
||||
push(@rv, $ini);
|
||||
}
|
||||
closedir(DIR);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user