Fixes and cleanup in shares template

tags/0.0.1_0.fc26_el5
Daniel Berteaud 8 years ago
parent 9ac0ec6917
commit c793cdef93
  1. 22
      root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares

@ -6,23 +6,25 @@ my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database"
foreach my $share ($a->get_all_by_prop(type => 'share')){ foreach my $share ($a->get_all_by_prop(type => 'share')){
my $pool_name = $share->key; my $pool_name = $share->key;
next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled'); next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled');
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M'; my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';
my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30'; my $max_execution_time = $share->prop('PHPMaxExecutionTime') || '30';
my $allow_url_fopen = $share->prop('PHPAllowUrlFopen') || 'disabled'; my $allow_url_fopen = $share->prop('PHPAllowUrlFopen') || 'disabled';
my $post_max_size = $share->prop('PHPPostMaxSize') || '10M'; my $post_max_size = $share->prop('PHPPostMaxSize') || '10M';
my $upload_max_filesize = $share->prop('PHPUploadMaxFilesize') || '10M'; my $upload_max_filesize = $share->prop('PHPUploadMaxFilesize') || '10M';
my $file_upload = $share->prop('PHPFileUpload') || 'enabled'; my $file_upload = $share->prop('PHPFileUpload') || 'enabled';
my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key . ':/var/lib/php/' . $pool_name; my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $$pool_name .
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' . ':/var/lib/php/' . $pool_name;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
'symlink,exec,dl,shell_exec,' . 'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' . 'passthru,phpinfo,' .
'escapeshellarg,escapeshellcmd'; 'escapeshellarg,escapeshellcmd';
# Format vars # Format vars
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$disabled_functions = join(', ', split /[,;:]/, $disabled_functions); $disabled_functions = join(', ', split /[,;:]/, $disabled_functions);
my $version = $share->prop('PHPVersion') || 'default'; my $version = $share->prop('PHPVersion') || 'default';
$OUT .=<<"_EOF" if ($version == $PHP_VERSION or ($PHP_VERSION eq '' && $version == 'default'));
$OUT .=<<"_EOF" if ($version eq $PHP_VERSION or ($PHP_VERSION eq '' && $version eq 'default'));
[$pool_name] [$pool_name]
user = www user = www

Loading…
Cancel
Save