Cleanups in shares php pool templates

This commit is contained in:
Daniel Berteaud 2017-07-14 12:29:46 +02:00
parent daef899874
commit d7656b699c
1 changed files with 8 additions and 7 deletions

View File

@ -4,8 +4,9 @@ use esmith::AccountsDB;
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database";
foreach my $share ($a->get_all_by_prop(type => 'share')){
next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled');
my $version = $share->prop('PHPVersion') || '';
my $dynamic = $share->prop('DynamicContent') || 'disabled';
next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION);
my $key = $share->key;
my $pool_name = 'php' . $version . '-' . $key;
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';
@ -18,13 +19,14 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){
my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key .
':/var/lib/php/' . $key;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' .
'escapeshellarg,escapeshellcmd';
'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' .
'escapeshellarg,escapeshellcmd';
# Format vars
$file_upload = ($file_upload =~ 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);
$open_basedir = join(':', split(/[,;:]/, $open_basedir));
$OUT .=<<"_EOF" if ($version eq $PHP_VERSION);
@ -40,11 +42,9 @@ pm.max_children = 15
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 4
pm.max_requests = 5000
request_terminate_timeout = 30
pm.max_requests = 1000
slowlog = /var/log/php/$key/slow.log
php_admin_value[session.save_path] = /var/lib/php/$key/session
php_admin_value[soap.wsdl_cache_dir] = /var/lib/php/$key/wsdlcache
php_admin_value[opcache.file_cache] = /var/lib/php/$key/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$key/tmp
php_admin_value[error_log] = /var/log/php/$key/error.log
@ -63,6 +63,7 @@ php_admin_flag[file_upload] = $file_upload
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_value[open_basedir] = $open_basedir
_EOF
}