Skip to content

Commit bb4a077

Browse files
Simon Schneiderarthurzenika
authored andcommitted
feat(php/ng): support for php cli multiversion
1 parent dbb542c commit bb4a077

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

php/ng/cli/ini.sls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,16 @@
1111
{% endif %}
1212
{% endfor %}
1313
14+
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
15+
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
16+
{% for version in pillar_php_ng_version %}
17+
{% set first_version = pillar_php_ng_version[0]|string %}
18+
{% set ini = php.lookup.cli.ini|replace(first_version, version) %}
19+
php_cli_ini_{{ version }}:
20+
{{ php_ini(ini, php.cli.ini.opts, settings) }}
21+
{% endfor %}
22+
{% else %}
23+
1424
php_cli_ini:
1525
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
26+
{% endif %}

php/ng/cli/init.sls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ include:
44
- php.ng.cli.install
55
- php.ng.cli.ini
66

7+
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
8+
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
9+
extend:
10+
{% for version in pillar_php_ng_version %}
11+
php_cli_ini_{{ version }}:
12+
file:
13+
- require:
14+
- sls: php.ng.cli.install
15+
{% endfor %}
16+
{% else %}
717
extend:
818
php_cli_ini:
919
file:
1020
- require:
1121
- sls: php.ng.cli.install
22+
{% endif %}

php/ng/cli/install.sls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33

44
{%- if salt['grains.get']('os_family') == "Debian" %}
55
{% set current_php = salt['alternatives.show_current']('php') %}
6+
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
7+
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
8+
{% if 'alternatives_version' in salt['pillar.get']('php:ng') %}
9+
{% set phpng_version = salt['pillar.get']('php:ng:alternatives_version') %}
10+
{% else %}
11+
{% set phpng_version = false %}
12+
{% endif %}
13+
{% else %}
614
{% set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}
15+
{% endif %}
716

17+
{% if phpng_version %}
818
php_{{ phpng_version }}_link:
919
alternatives.set:
1020
- name: php
@@ -15,3 +25,4 @@ php_{{ phpng_version }}_link:
1525
- which php
1626
- test {{ current_php }} != $(which php{{ phpng_version }})
1727
{% endif %}
28+
{% endif %}

0 commit comments

Comments
 (0)