mirror of
https://github.com/webmin/webmin.git
synced 2025-07-23 00:30:33 +00:00
Allow modules to be enabled or disabled
This commit is contained in:
@ -171,6 +171,12 @@ disable_err=Failed to save disabled features
|
||||
disable_classes=Disabled built-in classes
|
||||
|
||||
mods_title=PHP Modules
|
||||
mods_edir=Could not find PHP modules directory!
|
||||
mods_ecannot=You are not allowed to edit enabled PHP modules
|
||||
mods_desc=This page can be used to globally enable and disable PHP modules for all users on this system.
|
||||
mods_enabled=Enabled?
|
||||
mods_name=Module name
|
||||
mods_file=Config file
|
||||
|
||||
log_manual=Manually edit file $1
|
||||
log_vars=Changed PHP variables in $1
|
||||
@ -181,6 +187,7 @@ log_safe=Changed safe mode options in $1
|
||||
log_limits=Changed resource limits in $1
|
||||
log_errors=Changed error logging in $1
|
||||
log_misc=Changed other settings in $1
|
||||
log_mods=Updated enabled modules in $1
|
||||
|
||||
acl_global=Can edit global PHP configuration?
|
||||
acl_anyfile=Can edit any file as a PHP configuration?
|
||||
|
@ -19,7 +19,7 @@ $inidir = &get_php_ini_dir($in{'file'});
|
||||
@pages = ( "vars", "dirs", "db", "session", "limits",
|
||||
"errors", "disable", "misc" );
|
||||
push(@pages, "manual") if ($access{'manual'} ne '0');
|
||||
push(@pages, "mods") if ($inidir);
|
||||
push(@pages, "mods") if ($inidir && $access{'global'});
|
||||
@links = map { "edit_${_}.cgi?file=".&urlize($in{'file'})."&oneini=1" } @pages;
|
||||
@titles = map { $text{$_."_title"} } @pages;
|
||||
@icons = map { "images/$_.gif" } @pages;
|
||||
|
@ -657,14 +657,34 @@ foreach my $f (readdir(DIR)) {
|
||||
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;
|
||||
$ini->{'enabled'} = $1 ? 0 : 1;
|
||||
$ini->{'mod'} = $2;
|
||||
}
|
||||
}
|
||||
push(@rv, $ini);
|
||||
}
|
||||
closedir(DIR);
|
||||
return @rv;
|
||||
return sort { $a->{'mod'} cmp $b->{'mod'} } @rv;
|
||||
}
|
||||
|
||||
# enable_php_ini_module(&ini, enabled?)
|
||||
# Enable or disable a module loaded from a php.ini include file
|
||||
sub enable_php_ini_module
|
||||
{
|
||||
my ($ini, $enable) = @_;
|
||||
return if ($ini->{'enabled'} == $enable);
|
||||
&lock_file($ini->{'path'});
|
||||
my $lref = &read_file_lines($ini->{'path'});
|
||||
foreach my $l (@$lref) {
|
||||
if ($enable && !$ini->{'enabled'}) {
|
||||
$l =~ s/^\s*;\s*(extension\s*=\s*(\S+)\.so)/$1/;
|
||||
}
|
||||
elsif (!$enable && $ini->{'enabled'}) {
|
||||
$l =~ s/^\s*(extension\s*=\s*(\S+)\.so)/;$1/;
|
||||
}
|
||||
}
|
||||
&flush_file_lines($ini->{'path'});
|
||||
&unlock_file($ini->{'path'});
|
||||
}
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user