Saltstack Official PHP Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

91 lines
2.3KB

  1. {%- from "php/map.jinja" import php with context %}
  2. include:
  3. - php.deprecated
  4. - php
  5. - php.dev
  6. {%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}
  7. {%- if salt['grains.get']('os') == "Ubuntu" %}
  8. {%- if php_version >= '7.0' %}
  9. {%- set suhosin_ext = php.suhosin7_ext %}
  10. {%- set suhosin_name = 'suhosin7' %}
  11. {%- set suhosin_repo = php.suhosin7_repo %}
  12. {%- set tmppath = '/tmp/suhosin7' %}
  13. {%- else %}
  14. {%- set suhosin_ext = php.suhosin5_ext %}
  15. {%- set suhosin_name = 'suhosin' %}
  16. {%- set suhosin_repo = php.suhosin5_repo %}
  17. {%- set tmppath = '/tmp/suhosin5' %}
  18. {%- endif %}
  19. {%- elif salt['grains.get']('os_family') == "RedHat" %}
  20. {%- if grains['osmajorrelease'] == "7" %}
  21. {%- set suhosin_ext = php.suhosin5_ext %}
  22. {%- set suhosin_name = 'suhosin' %}
  23. {%- set suhosin_repo = php.suhosin5_repo %}
  24. {%- set tmppath = '/tmp/suhosin5' %}
  25. {%- else %}
  26. {# RHEL version 6 contains PHP 5.3, which is not supported by Suhosin #}
  27. {%- endif %}
  28. {%- else %}
  29. {%- set suhosin_ext = php.suhosin5_ext %}
  30. {%- set suhosin_name = 'suhosin' %}
  31. {%- set suhosin_repo = php.suhosin5_repo %}
  32. {%- set tmppath = '/tmp/suhosin5' %}
  33. {%- endif %}
  34. build-pkgs:
  35. pkg.installed:
  36. - pkgs: {{ php.build_pkgs }}
  37. git:
  38. pkg.installed: []
  39. suhosin-source:
  40. git.latest:
  41. - name: {{ suhosin_repo }}
  42. - target: {{ tmppath }}
  43. - unless:
  44. - test -d {{ tmppath }}
  45. - require:
  46. - pkg: git
  47. install-suhosin:
  48. cmd.run:
  49. - name: |
  50. phpize
  51. ./configure
  52. make
  53. make install
  54. - cwd: {{ tmppath }}
  55. - shell: /bin/bash
  56. - runas: root
  57. - unless:
  58. - test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  59. - require:
  60. - pkg: build-pkgs
  61. - git: suhosin-source
  62. php-suhosin-conf:
  63. file.managed:
  64. - name: {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  65. - contents: |
  66. extension={{ suhosin_ext }}
  67. suhosin.executor.include.whitelist=phar
  68. - require:
  69. - pkg: {{ php.php_pkg }}
  70. - cmd: install-suhosin
  71. - unless:
  72. - test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
  73. {%- if salt['grains.get']('os_family') == "Debian" %}
  74. php-suhosin-enable:
  75. cmd.run:
  76. - name: {{ php.phpenmod_command }} {{ suhosin_name }}
  77. - require:
  78. - file: php-suhosin-conf
  79. {%- endif %}