Skip to content

Commit

Permalink
feat: allow the configuration of any opcache variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpiron committed May 15, 2024
1 parent 51684c4 commit 02f5653
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 3 additions & 10 deletions templates/opcache.ini.j2
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
zend_extension={{ php_opcache_zend_extension }}
opcache.enable={{ php_opcache_enable }}
opcache.enable_cli={{ php_opcache_enable_cli }}
opcache.memory_consumption={{ php_opcache_memory_consumption }}
opcache.interned_strings_buffer={{ php_opcache_interned_strings_buffer }}
opcache.max_accelerated_files={{ php_opcache_max_accelerated_files }}
opcache.max_wasted_percentage={{ php_opcache_max_wasted_percentage }}
opcache.validate_timestamps={{ php_opcache_validate_timestamps }}
opcache.revalidate_path={{ php_opcache_revalidate_path }}
opcache.revalidate_freq={{ php_opcache_revalidate_freq }}
opcache.max_file_size={{ php_opcache_max_file_size }}
{% for key, var in opcache_vars.items() %}
opcache.{{ key }}={{ var }}
{% endfor %}
{% if php_opcache_blacklist_filename != '' %}
opcache.blacklist_filename={{ php_opcache_blacklist_filename }}
{% endif %}
13 changes: 13 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__opcache_var_names: "{{ lookup('varnames',
'^php_opcache_(?!(zend_extension|conf_filename|blacklist_filename)).*$',
wantlist=True) }}"
__opcache_var_values: "{{ lookup('vars',
*__opcache_var_names,
wantlist=True) }}"
opcache_vars: "{{ __opcache_var_names
| map('regex_replace', '^(php_opcache_)', '')
| map('community.general.dict_kv', 'key')
| zip(__opcache_var_values
| map('community.general.dict_kv', 'value'))
| map('combine')
| items2dict }}"

0 comments on commit 02f5653

Please sign in to comment.