Merge pull request #183 from sticky-note/feat/ng

feat(ng): promote NG formula
This commit is contained in:
Imran Iqbal 2019-08-26 16:34:34 +01:00 committed by GitHub
commit de91f7f50a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
217 changed files with 4382 additions and 5498 deletions

View File

@ -21,25 +21,28 @@ Formula to set up and configure php
:header-rows: 1
:widths: 1
* - WARNING: BREAKING CHANGES IN UPCOMING ``v1.0.0``
* - This formula currently provides two methods for managing PHP; the old method
under ``php`` and the new method under ``php.ng``.
In upcoming `v1.0.0 <https://github.com/saltstack-formulas/php-formula/releases/tag/v1.0.0>`_,
the old method will be removed and ``php.ng`` will be promoted to ``php`` in its place.
If you are not in a position to migrate, you will need to pin your repo to
the final release tag before
* - WARNING: BREAKING CHANGES SINCE ``v1.0.0``
* - Prior to
`v1.0.0 <https://github.com/saltstack-formulas/php-formula/releases/tag/v1.0.0>`_,
which is expected to be
this formula provided two methods for managing PHP;
the old method under ``php`` and the new method under ``php.ng``.
The old method has now been removed and ``php.ng`` has been promoted to
be ``php`` in its place.
If you are not in a position to migrate, please pin your repo to the final
release tag before
`v1.0.0 <https://github.com/saltstack-formulas/php-formula/releases/tag/v1.0.0>`_,
i.e.
`v0.40.1 <https://github.com/saltstack-formulas/php-formula/releases/tag/v0.40.1>`_.
If you are currently using ``php.ng``, there is nothing to do until
`v1.0.0 <https://github.com/saltstack-formulas/php-formula/releases/tag/v1.0.0>`_
is released.
To migrate from ``php.ng``, simply modify your pillar to promote the
entire section under ``php:ng`` so that it is under ``php`` instead.
So with the editor of your choice, highlight the entire section and then
unindent one level. Finish by removing the ``ng:`` line.
To migrate from the old ``php``, the first step is to convert to ``php.ng``,
before `v1.0.0 <https://github.com/saltstack-formulas/php-formula/releases/tag/v1.0.0>`_
is released.
To migrate from the old ``php``, first convert to ``php.ng`` under
`v0.40.1 <https://github.com/saltstack-formulas/php-formula/releases/tag/v0.40.1>`_.
and then follow the steps laid out in the paragraph directly above.
.. contents:: **Table of Contents**
@ -70,694 +73,489 @@ Available states
.. contents::
:local:
``php``
^^^^^^^
Installs the php package.
``php.adodb``
^^^^^^^^^^^^^
Installs the php-adodb package.
``php.apc``
^^^^^^^^^^^
Installs the php-apc package.
Disabled by default on opensuse need server:php repo
``php.apcu``
^^^^^^^^^^^^
Installs the php-apcu package.
Disabled by default on opensuse need server:php repo
``php.bcmath``
^^^^^^^^^^^^^^
Installs the php-bcmath package.
``php.cgi``
^^^^^^^^^^^
Installs the php-cgi package.
Disabled on opensuse not available, only fastcgi
``php.cli``
^^^^^^^^^^^
Installs the php-cli package.
``php.composer``
^^^^^^^^^^^^^^^^
Installs [composer](https://getcomposer.org) and keeps it updated.
``php.curl``
^^^^^^^^^^^^
Installs the php5-curl package on Debian, and ensures that curl itself is
installed for RedHat systems, this is due to the curl libs being provided by
php-common, which will get installed with the main php package.
``php.dev``
^^^^^^^^^^^
Installs the php-dev package.
``php.fileinfo``
^^^^^^^^^^^^^^^^
Installs the php-fileinfo package and enables it.
``php.fpm``
^^^^^^^^^^^
Installs the php-fpm package, starts the service, and enables it.
``php.gd``
^^^^^^^^^^
Installs the php-gd package.
``php.imagick``
^^^^^^^^^^^^^^^
Installs the php-imagick package.
Disabled on opensuse not available.
``php.imap``
^^^^^^^^^^^^
Installs the php-imap package.
``php.intl``
^^^^^^^^^^^^
Installs the php-intl package.
``php.json``
^^^^^^^^^^^^
Installs the php-json package.
``php.ldap``
^^^^^^^^^^^^
Installs the php-ldap package.
``php.mail``
^^^^^^^^^^^^
Installs the php-mail package.
``php.mbstring``
^^^^^^^^^^^^^^^^
Installs the php-mbstring package.
``php.mcrypt``
^^^^^^^^^^^^^^
Installs the php-mcrypt package.
``php.memcache``
^^^^^^^^^^^^^^^^
Installs the php-memcache package.
Disabled on opensuse need server:php:extensions repo
``php.memcached``
^^^^^^^^^^^^^^^^^
Installs the php-memcached package.
Disabled on opensuse need server:php:extensions repo
``php.mongo``
^^^^^^^^^^^^^
Installs the php-mongo package.
Disabled on opensuse need server:php:extensions repo
``php.mysql``
^^^^^^^^^^^^^
Installs the php-mysql package.
``php.mysqlnd``
^^^^^^^^^^^^^^^
Installs the php-mysqlnd package.
Disabled on opensuse no package.
``php.oauth``
^^^^^^^^^^^^^
Installs the php-oauth package.
``php.pear``
^^^^^^^^^^^^
Installs the php-pear package.
``php.pgsql``
^^^^^^^^^^^^^
Installs the php-pgsql package.
``php.readline``
^^^^^^^^^^^^^^^^
Installs the php-readline package.
``php.redis``
^^^^^^^^^^^^^
Installs the php-redis package.
Disabled on opensuse need server:php:extensions repo
``php.soap``
^^^^^^^^^^^^
Installs the php-soap package.
``php.sqlite``
^^^^^^^^^^^^^^
Installs the php-sqlite package,
``php.suhosin``
^^^^^^^^^^^^^^^
Installs the php-suhosin package.
``php.sybase``
^^^^^^^^^^^^^^
Installs the php-sybase package for Sybase/MS-SQL. Debian / Ubuntu as RedHat has no similar package.
``php.tokenizer``
^^^^^^^^^^^^^^^^^
Installs the php-tokenizer package and enables it.
``php.xml``
^^^^^^^^^^^
Installs the php-xml package.
``php.zip``
^^^^^^^^^^^
Installs the php-zip package.
Next-generation, alternate approach
-----------------------------------
The following states provide an alternate approach to managing PHP and FPM
pools, as well as code organization. Please provide feedback by filing issues,
Please provide feedback by filing issues,
discussing in ``#salt`` in Freenode and the mailing list as normal.
**Note:** php.ng states require the merge parameter of salt.modules.pillar.get(),
**Note:** php states require the merge parameter of salt.modules.pillar.get(),
first available in the Helium release.
.. contents::
:local:
``php.ng``
``php``
^^^^^^^^^^
Installs the php package.
``php.ng.adodb``
``php.adodb``
^^^^^^^^^^^^^^^^
Installs the php-adodb package.
``php.ng.apache2``
``php.apache2``
^^^^^^^^^^^^^^^^^^
Meta-state that combines `php.ng.apache2.install`_ and `php.ng.apache2.ini`_.
Meta-state that combines `php.apache2.install`_ and `php.apache2.ini`_.
``php.ng.apache2.ini``
``php.apache2.ini``
^^^^^^^^^^^^^^^^^^^^^^
Manages the apache2 php.ini file
``php.ng.apache2.install``
``php.apache2.install``
^^^^^^^^^^^^^^^^^^^^^^^^^^
Installs the apache2 and libapache2-mod-php5 package. Debian Only.
``php.ng.apc``
``php.apc``
^^^^^^^^^^^^^^
Installs the php-apc package.
Disabled on opensuse need server:php repo
``php.ng.apcu``
``php.apcu``
^^^^^^^^^^^^^^^
Installs the php-apcu package.
Disabled on opensuse need server:php repo
``php.ng.auth-sasl``
``php.auth-sasl``
^^^^^^^^^^^^^^^^^^^^
Installs the php-auth-sasl package.
``php.ng.bcmath``
``php.bcmath``
^^^^^^^^^^^^^^^^^
Installs the php-bcmath package.
``php.ng.bz2``
``php.bz2``
^^^^^^^^^^^^^^
Installs the php-bz2 package.
``php.ng.cache-lite``
``php.cache-lite``
^^^^^^^^^^^^^^^^^^^^^
Installs the php-cache-lite package.
``php.ng.cgi``
``php.cgi``
^^^^^^^^^^^^^^
Installs the php-cgi package.
Disabled on opensuse only php5-fastcgi available.
``php.ng.cli``
``php.cli``
^^^^^^^^^^^^^^
Meta-state that combines `php.ng.cli.install`_ and `php.ng.cli.ini`_.
Meta-state that combines `php.cli.install`_ and `php.cli.ini`_.
``php.ng.cli.ini``
``php.cli.ini``
^^^^^^^^^^^^^^^^^^
Manages the php-cli ini file.
``php.ng.cli.install``
``php.cli.install``
^^^^^^^^^^^^^^^^^^^^^^
Installs the php-cli package.
``php.ng.composer``
``php.composer``
^^^^^^^^^^^^^^^^^^^
Installs [composer](https://getcomposer.org) and keeps it updated.
``php.ng.console-table``
``php.console-table``
^^^^^^^^^^^^^^^^^^^^^^^^
Installs the php-console-table package.
``php.ng.ctype``
``php.ctype``
^^^^^^^^^^^^^^^^
Installs the php-ctype package.
``php.ng.curl``
``php.curl``
^^^^^^^^^^^^^^^
Installs the php5-curl package on Debian, and ensures that curl itself is
installed for RedHat systems, this is due to the curl libs being provided by
php-common, which will get installed with the main php package.
``php.ng.dba``
``php.dba``
^^^^^^^^^^^^^^
Installs the php-dba package.
``php.ng.dev``
``php.dev``
^^^^^^^^^^^^^^
Installs the php5-dev and build-essential package.
``php.ng.filter``
``php.filter``
^^^^^^^^^^^^^^^^^
Installs the php-filter package.
``php.ng.fpm``
``php.fpm``
^^^^^^^^^^^^^^
Meta-state that combines all php.ng.fpm states.
Meta-state that combines all php.fpm states.
``php.ng.fpm.config``
``php.fpm.config``
^^^^^^^^^^^^^^^^^^^^^
Manages the (non-pool) php-fpm config files.
``php.ng.fpm.install``
``php.fpm.install``
^^^^^^^^^^^^^^^^^^^^^^
Installs the php-fpm package.
``php.ng.fpm.pools``
``php.fpm.pools``
^^^^^^^^^^^^^^^^^^^^
Meta-state that combines `php.ng.fpm.service`_ and `php.ng.fpm.pools_config`_
Meta-state that combines `php.fpm.service`_ and `php.fpm.pools_config`_
``php.ng.fpm.pools_config``
``php.fpm.pools_config``
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Manages php-fpm pool config files.
``php.ng.fpm.service``
``php.fpm.service``
^^^^^^^^^^^^^^^^^^^^^^
Manages the php-fpm service.
``php.ng.gd``
``php.gd``
^^^^^^^^^^^^^
Installs the php-gd package.
``php.ng.gearman``
``php.gearman``
^^^^^^^^^^^^^^^^^^
Installs the php-gearman package.
``php.ng.geoip``
``php.geoip``
^^^^^^^^^^^^^^^^
Installs the php-geoip package.
``php.ng.geshi``
``php.geshi``
^^^^^^^^^^^^^^^^
Installs the php-geshi package.
``php.ng.gettext``
``php.gettext``
^^^^^^^^^^^^^^^^^^
Installs the php-gettext package.
``php.ng.gmp``
``php.gmp``
^^^^^^^^^^^^^^
Installs the php-gmp package. Debian Only.
``php.ng.hash``
``php.hash``
^^^^^^^^^^^^^^^
Installs the php-hash package.
``php.ng.http``
``php.http``
^^^^^^^^^^^^^^^
Installs the php-http package.
``php.ng.hhvm``
``php.hhvm``
^^^^^^^^^^^^^^^
Meta-state that combines php.ng.hhvm states
Meta-state that combines php.hhvm states
``php.ng.hhvm.config``
``php.hhvm.config``
^^^^^^^^^^^^^^^^^^^^^^
Manages the php-hhvm config files
``php.ng.hhvm.install``
``php.hhvm.install``
^^^^^^^^^^^^^^^^^^^^^^^
Installs the php-hhvm package
``php.ng.hhvm.repo``
``php.hhvm.repo``
^^^^^^^^^.REPO^^^^^^
Configures the hhvm repo for debian/ubuntu
``php.ng.hhvm.service``
``php.hhvm.service``
^^^^^^^^^^^^^^^^^^^^^^^
Manages the php-hhvm service.
``php.ng.igbinary``
``php.igbinary``
^^^^^^^^^^^^^^^^^^^
Installs the php-igbinary package.
``php.ng.imagick``
``php.imagick``
^^^^^^^^^^^^^^^^^^
Installs the php-imagick package.
Disabled on opensuse no package.
``php.ng.imap``
``php.imap``
^^^^^^^^^^^^^^^
Installs the php-imap package.
``php.ng.intl``
``php.intl``
^^^^^^^^^^^^^^^
Installs the php-intl package.
``php.ng.json``
``php.json``
^^^^^^^^^^^^^^^
Installs the php-json package.
``php.ng.ldap``
``php.ldap``
^^^^^^^^^^^^^^^
Installs the php-ldap package.
``php.ng.mail``
``php.mail``
^^^^^^^^^^^^^^^
Installs the php-mail package.
``php.ng.mbstring``
``php.mbstring``
^^^^^^^^^^^^^^^^^^^
Installs the php-mbstring package.
``php.ng.mcrypt``
``php.mcrypt``
^^^^^^^^^^^^^^^^^
Installs the php-mcrypt package.
``php.ng.mdb2``
``php.mdb2``
^^^^^^^^^^^^^^^
Installs the php-mdb2 package.
``php.ng.mdb2-driver-mysql``
``php.mdb2-driver-mysql``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Installs the php-mdb2-driver-mysql package.
``php.ng.mdb2-driver-pgsql``
``php.mdb2-driver-pgsql``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Installs the php-mdb2-driver-pgsql package.
``php.ng.memcache``
``php.memcache``
^^^^^^^^^^^^^^^^^^^
Installs the php-memcache package.
Disabled on opensuse need server:php:extensions repo
``php.ng.memcached``
``php.memcached``
^^^^^^^^^^^^^^^^^^^^
Installs the php-memcached package.
Disabled on opensuse need server:php:extensions repo
``php.ng.modules``
``php.modules``
^^^^^^^^^^^^^^^^^^
Calls ``php.ng.<name>`` for each entry in ``php:ng:modules`` if available, or
Calls ``php.<name>`` for each entry in ``php:modules`` if available, or
try to install the matching packages that can be set via from
``php:ng:lookup:pkgs``
``php:lookup:pkgs``
``php.ng.mongo``
``php.mongo``
^^^^^^^^^^^^^^^^
Installs the php-mongo package.
``php.ng.mongodb``
``php.mongodb``
^^^^^^^^^^^^^^^^^^
Installs the php-mongodb package.
``php.ng.msgpack``
``php.msgpack``
^^^^^^^^^^^^^^^^^^
Installs the php-msgpack package.
``php.ng.mysql``
``php.mysql``
^^^^^^^^^^^^^^^^
Installs the php-mysql package.
``php.ng.mysqlnd``
``php.mysqlnd``
^^^^^^^^^^^^^^^^^^
Installs the php-mysqlnd package.
Disabled on opensuse no package.
``php.ng.net-smtp``
``php.net-smtp``
^^^^^^^^^^^^^^^^^^^
Installs the php-net-smtp package.
``php.ng.net4``
``php.net4``
^^^^^^^^^^^^^^^
Installs the php-net4 package.
``php.ng.net6``
``php.net6``
^^^^^^^^^^^NET6
Installs the php-net6 package.
``php.ng.oauth``
``php.oauth``
^^^^^^^^^^^^^^^^
Installs the php-oauth package.
``php.ng.opcache``
``php.opcache``
^^^^^^^^^^^^^^^^^^
Installs the php-opcache package.
``php.ng.openssl``
``php.openssl``
^^^^^^^^^^^^^^^^^^
Installs the php-openssl package.
``php.ng.pear``
``php.pear``
^^^^^^^^^^^^^^^
Installs the php-pear package.
``php.ng.pgsql``
``php.pgsql``
^^^^^^^^^^^^^^^^
Installs the php-pgsql package.
``php.ng.phar``
``php.phar``
^^^^^^^^^^^^^^^
Installs the php-phar package.
``php.ng.posix``
``php.posix``
^^^^^^^^^^^^^^^^
Installs the php-posix package.
``php.ng.pspell``
``php.pspell``
^^^^^^^^^^^^^^^^^
Installs the php-pspell package.
``php.ng.readline``
``php.readline``
^^^^^^^^^^^^^^^^^^^
Installs the php-readline package.
``php.ng.redis``
``php.redis``
^^^^^^^^^^^^^^^^
Installs the php-redis package.
Disabled on opensuse need server:php:extensions repo
``php.ng.seclib``
``php.seclib``
^^^^^^^^^^^^^^^^^
Installs the php-seclib package.
``php.ng.session``
``php.session``
^^^^^^^^^^^^^^^^^^
Installs the php-session package.
``php.ng.snmp``
``php.snmp``
^^^^^^^^^^^^^^^
Installs the php-snmp package.
``php.ng.soap``
``php.soap``
^^^^^^^^^^^^^^^
Installs the php-soap package.
``php.ng.sqlite``
``php.sqlite``
^^^^^^^^^^^^^^^^^
Installs the php-sqlite package,
``php.ng.ssh2``
``php.ssh2``
^^^^^^^^^^^^^^^
Installs the php-ssh2 package,
``php.ng.suhosin``
``php.suhosin``
^^^^^^^^^^^^^^^^^^
Installs the php-suhosin package.
``php.ng.svn``
``php.svn``
^^^^^^^^^^^^^^
Installs the php-svn package.
``php.ng.sybase``
``php.sybase``
^^^^^^^^^^^^^^^^^
Installs the php-sybase package.
``php.ng.tcpdf``
``php.tcpdf``
^^^^^^^^^^^^^^^^
Installs the php-tcpdf package.
``php.ng.tidy``
``php.tidy``
^^^^^^^^^^^^^^^
Installs the php-tidy package.
``php.ng.uuid``
``php.uuid``
^^^^^^^^^^^^^^^
Installs the php-uuid package.
``php.ng.xcache``
``php.xcache``
^^^^^^^^^^^^^^^^^
Meta-state that combines `php.ng.xcache.install`_ and `php.ng.xcache.ini`_.
Meta-state that combines `php.xcache.install`_ and `php.xcache.ini`_.
``php.ng.xcache.ini``
``php.xcache.ini``
^^^^^^^^^^^^^^^^^^^^^
Manages the php-xcache ini file
``php.ng.xcache.install``
``php.xcache.install``
^^^^^^^^^^^^^^^^^^^^^^^^^
Installs the php-xcache package.
Disabled on opensuse need server:php:extensions repo
``php.ng.xdebug``
``php.xdebug``
^^^^^^^^^^^^^^^^^
Installs the php-xdebug package.
``php.ng.xml``
``php.xml``
^^^^^^^^^^^^^^
Installs the php-xml package.
``php.ng.xsl``
``php.xsl``
^^^^^^^^^^^^^^
Installs the php-xsl package.
``php.ng.zip``
``php.zip``
^^^^^^^^^^^^^^
Installs the php-zip package.

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-adodb:
pkg.installed:
- name: {{ php.adodb_pkg }}
{% set state = 'adodb' %}
{% include "php/installed.jinja" %}

View File

@ -1,6 +1,6 @@
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/map.jinja" import phpng_version with context %}
{% set major = phpng_version.split('.')|first %}
{% from "php/map.jinja" import php with context %}
{% from "php/map.jinja" import php_version with context %}
{% set major = php_version.split('.')|first %}
LoadModule php{{ major }}_module /usr/local/libexec/{{ php.lookup.apache2.name }}/libphp{{ major }}.so

9
php/apache2/ini.sls Normal file
View File

@ -0,0 +1,9 @@
# Manages the main Apache2 ini file
{% from "php/map.jinja" import php with context %}
{% from "php/ini.jinja" import php_ini %}
{% set settings = php.ini.defaults %}
{% do settings.update(php.apache2.ini.settings) %}
php_apache2_ini:
{{ php_ini(php.lookup.apache2.ini, php.apache2.ini.opts, settings) }}

13
php/apache2/init.sls Normal file
View File

@ -0,0 +1,13 @@
{% if grains['os_family'] in ["Debian", "FreeBSD"] %}
include:
- php.apache2.install
{% endif %} #END: os = Debian|FreeBSD
{% if grains['os_family'] == "Debian" %}
- php.apache2.ini
extend:
php_apache2_ini:
file:
- require:
- sls: php.apache2.install
{% endif %} #END: os = debian

18
php/apache2/install.sls Normal file
View File

@ -0,0 +1,18 @@
{% from "php/map.jinja" import php with context %}
{% set state = 'apache2' %}
{% include "php/installed.jinja" %}
{% if grains['os_family'] == "FreeBSD" %}
{{ php.lookup.apache2.module_config }}:
file.managed:
- source: salt://php/apache2/files/mod_php.conf.jinja
- template: jinja
{% if salt['pillar.get']('php:use_apache_formula', True) %}
- makedirs: true
- require_in:
- sls: apache
- watch_in:
- module: apache-restart
{% endif %} #END: use apache formula
{% endif %} #END: os = debian

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-apc:
pkg.installed:
- name: {{ php.apc_pkg }}
{% set state = 'apc' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-apcu:
pkg.installed:
- name: {{ php.apcu_pkg }}
{% set state = 'apcu' %}
{% include "php/installed.jinja" %}

2
php/auth-sasl.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'auth-sasl' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-bcmath:
pkg.installed:
- name: {{ php.bcmath_pkg }}
{% set state = 'bcmath' %}
{% include "php/installed.jinja" %}

2
php/bz2.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'bz2' %}
{% include "php/installed.jinja" %}

2
php/cache-lite.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'cache-lite' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-cgi:
pkg.installed:
- name: {{ php.cgi_pkg }}
{% set state = 'cgi' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +0,0 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-cli:
pkg.installed:
- name: {{ php.cli_pkg }}

26
php/cli/ini.sls Normal file
View File

@ -0,0 +1,26 @@
# Manages the php cli main ini file
{% from "php/map.jinja" import php with context %}
{% from "php/ini.jinja" import php_ini %}
{% set settings = php.ini.defaults %}
{% for key, value in php.cli.ini.settings.items() %}
{% if settings[key] is defined %}
{% do settings[key].update(value) %}
{% else %}
{% do settings.update({key: value}) %}
{% endif %}
{% endfor %}
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% for version in pillar_php_ng_version %}
{% set first_version = pillar_php_ng_version[0]|string %}
{% set ini = php.lookup.cli.ini|replace(first_version, version) %}
php_cli_ini_{{ version }}:
{{ php_ini(ini, php.cli.ini.opts, settings) }}
{% endfor %}
{% else %}
php_cli_ini:
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
{% endif %}

22
php/cli/init.sls Normal file
View File

@ -0,0 +1,22 @@
# Installs php-cli and manages the associated php.ini
include:
- php.cli.install
- php.cli.ini
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
{% if pillar_php_version is iterable and pillar_php_version is not string %}
extend:
{% for version in pillar_php_version %}
php_cli_ini_{{ version }}:
file:
- require:
- sls: php.cli.install
{% endfor %}
{% else %}
extend:
php_cli_ini:
file:
- require:
- sls: php.cli.install
{% endif %}

28
php/cli/install.sls Normal file
View File

@ -0,0 +1,28 @@
{% set state = 'cli' %}
{% include "php/installed.jinja" %}
{%- if salt['grains.get']('os_family') == "Debian" %}
{% set current_php = salt['alternatives.show_current']('php') %}
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
{% if pillar_php_version is iterable and pillar_php_version is not string %}
{% if 'alternatives_version' in salt['pillar.get']('php') %}
{% set php_version = salt['pillar.get']('php:alternatives_version') %}
{% else %}
{% set php_version = false %}
{% endif %}
{% else %}
{% set php_version = salt['pillar.get']('php:version', '7.0')|string %}
{% endif %}
{% if php_version %}
php_{{ php_version }}_link:
alternatives.set:
- name: php
- path: /usr/bin/php{{ php_version }}
- require_in:
- pkg: php_install_{{ state }}
- onlyif:
- which php
- test {{ current_php }} != $(which php{{ php_version }})
{% endif %}
{% endif %}

View File

@ -1,22 +1,29 @@
{%- from "php/map.jinja" import php with context %}
{% from "php/map.jinja" import php with context %}
{%- set install_file = php.local_bin + '/' + php.composer_bin %}
{% set install_file = php.lookup.pkgs.local_bin + '/' + php.lookup.pkgs.composer_bin %}
{%- if not salt['config.get']('sudo_user') %}
{%- set salt_user = salt['config.get']('user', 'root') %}
{%- else %}
{%- set salt_user = salt['config.get']('sudo_user', 'root') %}
{%- endif %}
{% if not salt['config.get']('sudo_user') %}
{% set salt_user = salt['config.get']('user', 'root') %}
{% else %}
{% set salt_user = salt['config.get']('sudo_user', 'root') %}
{% endif %}
{%- set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
{% set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
include:
- php.deprecated
- php
{% if grains['os_family'] == 'FreeBSD' %}
- php.filter
- php.hash
- php.json
- php.mbstring
- php.openssl
- php.phar
{% endif %}
get-composer:
file.managed:
- name: {{ php.temp_dir }}/installer
- name: {{ php.lookup.pkgs.temp_dir }}/installer
- mode: 0755
- unless: test -f {{ install_file }}
- source: https://getcomposer.org/installer
@ -26,7 +33,7 @@ get-composer:
install-composer:
cmd.run:
- name: php {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
- name: php {{ php.lookup.pkgs.temp_dir }}/installer --filename={{ php.lookup.pkgs.composer_bin }} --install-dir={{ php.lookup.pkgs.local_bin }}
- unless: test -f {{ install_file }}
- env:
- HOME: {{ salt_user_home }}
@ -47,7 +54,7 @@ update-composer:
{% else %}
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s")
{% endif %}
- cwd: {{ php.local_bin }}
- cwd: {{ php.lookup.pkgs.local_bin }}
- env:
- HOME: {{ salt_user_home }}
- require:

2
php/console-table.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'console-table' %}
{% include "php/installed.jinja" %}

2
php/ctype.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'ctype' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-curl:
pkg.installed:
- name: {{ php.curl_pkg }}
{% set state = 'curl' %}
{% include "php/installed.jinja" %}

2
php/dba.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'dba' %}
{% include "php/installed.jinja" %}

View File

@ -1,41 +1,32 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Evaluating as `False` by default, using this method since `defaults.yaml` not available in this repo #}
{%- if not salt['config.get']('php').get('warning_messages', {}).get('v1.0.0', {}).get('mute_critical', False) %}
php-deprecated-in-v1.0.0-test-succeed:
test.succeed_without_changes:
php-deprecated-in-v1.0.0-test-fail:
test.fail_without_changes:
- name: |
################################################################################
# #
# WARNING: BREAKING CHANGES IN UPCOMING VERSION `v1.0.0` #
# WARNING: BREAKING CHANGES SINCE `v1.0.0` #
# #
################################################################################
# #
# This formula currently provides two methods for managing PHP; the old method #
# under `php` and the new method under `php.ng`. In upcoming `v1.0.0`, the old #
# method will be removed and `php.ng` will be promoted to `php` in its place. #
# Prior to `v1.0.0`, this formula provided two methods for managing PHP; the #
# old method under `php` and the new method under `php.ng`. The old method #
# has now been removed and `php.ng` has been promoted to be `php` in its #
# place. #
# #
# If you are not in a position to migrate, you will need to pin your repo to #
# the final release tag before `v1.0.0`, which is expected to be `v0.40.1`. #
# If you are not in a position to migrate, please pin your repo to the final #
# release tag before `v1.0.0`, i.e. `v0.40.1`. #
# #
# If you are currently using `php.ng`, there is nothing to do until `v1.0.0` #
# is released. #
# To migrate from `php.ng`, simply modify your pillar to promote the entire #
# section under `php:ng` so that it is under `php` instead. So with the #
# editor of your choice, highlight the entire section and then unindent one #
# level. Finish by removing the `ng:` line. #
# #
# To migrate from the old `php`, the first step is to convert to `php.ng`, #
# before `v1.0.0` is released. #
# #
# To prevent this message being displayed again, set the pillar/config value: #
# #
# ``` #
# php: #
# warning_messages: #
# v1.0.0: #
# mute_critical: True #
# ``` #
# To migrate from the old `php`, first convert to `php.ng` under `v0.40.1` #
# and then follow the steps laid out in the paragraph directly above. #
# #
################################################################################
# - failhard: True
{%- endif %}
- failhard: True

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-dev:
pkg.installed:
- name: {{ php.dev_pkg }}
{% set state = 'dev' %}
{% include "php/installed.jinja" %}

2
php/dom.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'dom' %}
{% include "php/installed.jinja" %}

2
php/fileinfo.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'fileinfo' %}
{% include "php/installed.jinja" %}

2
php/filter.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'filter' %}
{% include "php/installed.jinja" %}

View File

@ -1,11 +0,0 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
php-fpm:
pkg.installed:
- name: {{ php.fpm_pkg }}
service.running:
- name: {{ php.fpm_service }}
- enable: True

63
php/fpm/config.sls Normal file
View File

@ -0,0 +1,63 @@
# Manages the php-fpm main ini file
{% from 'php/map.jinja' import php with context %}
{% from "php/ini.jinja" import php_ini %}
{% set ini_settings = php.ini.defaults %}
{% for key, value in php.fpm.config.ini.settings.items() %}
{% if ini_settings[key] is defined %}
{% do ini_settings[key].update(value) %}
{% else %}
{% do ini_settings.update({key: value}) %}
{% endif %}
{% endfor %}
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% for version in pillar_php_ng_version %}
{% set conf_settings = odict(php.lookup.fpm.defaults) %}
{% set first_version = pillar_php_ng_version[0]|string %}
{% set ini = php.lookup.fpm.ini|replace(first_version, version) %}
{% set conf = php.lookup.fpm.conf|replace(first_version, version) %}
{% set pools = php.lookup.fpm.pools|replace(first_version, version) %}
{% for key, value in conf_settings.items() %}
{% if value is string %}
{% do conf_settings.update({key: value.replace(first_version, version)}) %}
{% endif %}
{% endfor %}
{% do conf_settings.global.update({'pid': '/var/run/php' + version + '-fpm.pid' }) %}
{% do conf_settings.global.update({'error_log': '/var/log/php' + version + '-fpm.log' }) %}
php_fpm_ini_config_{{ version }}:
{{ php_ini(ini, php.fpm.config.ini.opts, ini_settings) }}
php_fpm_conf_config_{{ version }}:
{{ php_ini(conf, php.fpm.config.conf.opts, odict(conf_settings)) }}
{{ pools }}:
file.directory:
- name: {{ pools }}
- user: {{ php.lookup.fpm.user }}
- group: {{ php.lookup.fpm.group }}
- file_mode: 755
- make_dirs: True
{% endfor %}
{% else %}
{% set conf_settings = php.lookup.fpm.defaults %}
{% do conf_settings.update(php.fpm.config.conf.settings) %}
php_fpm_ini_config:
{{ php_ini(php.lookup.fpm.ini, php.fpm.config.ini.opts, ini_settings) }}
php_fpm_conf_config:
{{ php_ini(php.lookup.fpm.conf, php.fpm.config.conf.opts, conf_settings) }}
{{ php.lookup.fpm.pools }}:
file.directory:
- name: {{ php.lookup.fpm.pools }}
- user: {{ php.lookup.fpm.user }}
- group: {{ php.lookup.fpm.group }}
- file_mode: 755
- make_dirs: True
{% endif %}

44
php/fpm/init.sls Normal file
View File

@ -0,0 +1,44 @@
# Meta-state to fully install php.fpm
include:
- php.fpm.config
- php.fpm.service
- php.fpm.pools
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
extend:
php_fpm_service:
service:
- watch:
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% for version in pillar_php_ng_version %}
- file: php_fpm_ini_config_{{ version }}
- file: php_fpm_conf_config_{{ version }}
{% endfor %}
{% else %}
- file: php_fpm_ini_config
- file: php_fpm_conf_config
{% endif %}
- require:
- sls: php.fpm.config
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% for version in pillar_php_ng_version %}
php_fpm_ini_config_{{ version }}:
file:
- require:
- pkg: php_install_fpm
php_fpm_conf_config_{{ version }}:
file:
- require:
- pkg: php_install_fpm
{% endfor %}
{% else %}
php_fpm_ini_config:
file:
- require:
- pkg: php_install_fpm
php_fpm_conf_config:
file:
- require:
- pkg: php_install_fpm
{% endif %}

2
php/fpm/install.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'fpm' %}
{% include "php/installed.jinja" %}

24
php/fpm/pools.sls Normal file
View File

@ -0,0 +1,24 @@
# Manages the php-fpm pools config files
{% from "php/map.jinja" import php with context %}
{% from "php/macro.jinja" import sls_block %}
{% from "php/fpm/pools_config.sls" import pool_states with context %}
{% macro file_requisites(states) %}
{%- for state in states %}
- file: {{ state }}
{%- endfor -%}
{% endmacro %}
include:
- php.fpm.service
- php.fpm.pools_config
{% if pool_states %}
extend:
php_fpm_service:
service:
- watch:
{{ file_requisites(pool_states) }}
- require:
{{ file_requisites(pool_states) }}
{% endif %}

45
php/fpm/pools_config.sls Normal file
View File

@ -0,0 +1,45 @@
# Manages the php-fpm pools config files
{% from 'php/map.jinja' import php with context %}
{% from "php/macro.jinja" import sls_block, serialize %}
# Simple path concatenation.
{% macro path_join(file, root) -%}
{{ root ~ '/' ~ file }}
{%- endmacro %}
{% set pool_states = [] %}
{% for pool, config in php.fpm.pools.items() %}
{% if pool == 'defaults' %}{% continue %}{% endif %}
{% for pkey, pvalues in config.get('settings', {}).items() %}
{% set pool_defaults = php.fpm.pools.get('defaults', {}).copy() %}
{% do pool_defaults.update(pvalues) %}
{% do pvalues.update(pool_defaults) %}
{% endfor %}
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
{% set first_version = pillar_php_ng_version[0]|string %}
{% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %}
{% else %}
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}
{% endif %}
{{ state }}:
{% if config.enabled %}
file.managed:
{{ sls_block(config.get('opts', {})) }}
- name: {{ fpath }}
- source: salt://php/files/php.ini
- template: jinja
- context:
config: {{ serialize(config.get('settings', {})) }}
{% else %}
file.absent:
- name: {{ fpath }}
{% endif %}
{% do pool_states.append(state) %}
{% endfor %}

18
php/fpm/service.sls Normal file
View File

@ -0,0 +1,18 @@
# Manages the php-fpm service.
{% from "php/map.jinja" import php with context %}
{% from "php/macro.jinja" import sls_block %}
{% set service_function = {True:'running', False:'dead'}.get(php.fpm.service.enabled) %}
include:
- php.fpm.install
php_fpm_service:
service.{{ service_function }}:
{{ sls_block(php.fpm.service.opts) }}
- name: {{ php.lookup.fpm.service }}
- enable: {{ php.fpm.service.enabled }}
- require:
- sls: php.fpm.install
- watch:
- pkg: php_install_fpm

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-gd:
pkg.installed:
- name: {{ php.gd_pkg }}
{% set state = 'gd' %}
{% include "php/installed.jinja" %}

2
php/gearman.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'gearman' %}
{% include "php/installed.jinja" %}

2
php/geoip.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'geoip' %}
{% include "php/installed.jinja" %}

2
php/geshi.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'geshi' %}
{% include "php/installed.jinja" %}

2
php/gettext.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'gettext' %}
{% include "php/installed.jinja" %}

2
php/gmp.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'gmp' %}
{% include "php/installed.jinja" %}

2
php/hash.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'hash' %}
{% include "php/installed.jinja" %}

16
php/hhvm/config.sls Normal file
View File

@ -0,0 +1,16 @@
# Manages the php-hhvm main ini file
{% from "php/map.jinja" import php with context %}
{% from "php/ini.jinja" import php_ini %}
{% set server_settings = php.lookup.hhvm.server %}
{% do server_settings.update(php.hhvm.config.server.settings) %}
{% set php_settings = php.lookup.hhvm.php %}
{% do php_settings.update(php.hhvm.config.php.settings) %}
php_hhvm_ini_config:
{{ php_ini(php.lookup.hhvm.conf, php.hhvm.config.server.opts, server_settings) }}
php_hhvm_conf_config:
{{ php_ini(php.lookup.hhvm.ini, php.hhvm.config.php.opts, php_settings) }}

23
php/hhvm/init.sls Normal file
View File

@ -0,0 +1,23 @@
# Meta-state to fully install php.hhvm
include:
- php.hhvm.repo
- php.hhvm.config
- php.hhvm.service
extend:
php_hhvm_service:
service:
- watch:
- file: php_hhvm_ini_config
- file: php_hhvm_conf_config
- require:
- sls: php.hhvm.config
php_hhvm_ini_config:
file:
- require:
- pkg: php_install_hhvm
php_hhvm_conf_config:
file:
- require:
- pkg: php_install_hhvm

2
php/hhvm/install.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'hhvm' %}
{% include "php/installed.jinja" %}

19
php/hhvm/repo.sls Normal file
View File

@ -0,0 +1,19 @@
# Manages the php-hhvm service.
{% from "php/map.jinja" import php with context %}
include:
- php.hhvm.install
{% if salt['grains.get']('os_family') == 'Debian' -%}
hhvm_repo:
pkgrepo.managed:
- name: deb http://dl.hhvm.com/{{ salt['grains.get']('os')|lower }} {{ salt['grains.get']('oscodename')}} main
- file: /etc/apt/sources.list.d/hhvm.list
- keyid: 0x5a16e7281be7a449
- keyserver: keyserver.ubuntu.com
- refresh_db: True
- require_in:
- pkg: php_install_hhvm
{%- endif %}

19
php/hhvm/service.sls Normal file
View File

@ -0,0 +1,19 @@
# Manages the php-hhvm service.
{% from "php/map.jinja" import php with context %}
{% from "php/macro.jinja" import sls_block %}
{% set service_function = {True:'running', False:'dead'}.get(php.hhvm.service.enabled) %}
include:
- php.hhvm.install
php_hhvm_service:
service.{{ service_function }}:
{{ sls_block(php.hhvm.service.opts) }}
- name: {{ php.lookup.hhvm.service }}
- enable: {{ php.hhvm.service.enabled }}
- require:
- sls: php.hhvm.install
- watch:
- pkg: php_install_hhvm

2
php/http.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'http' %}
{% include "php/installed.jinja" %}

2
php/iconv.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'iconv' %}
{% include "php/installed.jinja" %}

2
php/igbinary.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'igbinary' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-imagick:
pkg.installed:
- name: {{ php.imagick_pkg }}
{% set state = 'imagick' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-imap:
pkg.installed:
- name: {{ php.imap_pkg }}
{% set state = 'imap' %}
{% include "php/installed.jinja" %}

View File

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=jinja
{# php.ini management macro. #}
{% from "php/ng/macro.jinja" import sls_block, serialize %}
{% from "php/macro.jinja" import sls_block, serialize %}
{% macro php_ini(filename, opts={}, settings={}) %}
file.managed:
{{ sls_block(opts) }}
- name: {{ filename }}
- source: salt://php/ng/files/php.ini
- source: salt://php/files/php.ini
- template: jinja
- context:
config: {{ serialize(odict(settings)) }}

View File

@ -1,33 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
{%- if not 'ng' in salt['pillar.get']('php', {}) %}
{%- if grains['os'] == "Ubuntu" %}
{%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %}
{%- if use_external_repo %}
{%- set external_repo_name = salt['pillar.get']('php:external_repo_name', 'ondrej/php') %}
php_from_ppa:
pkgrepo.managed:
- ppa: {{ external_repo_name }}
- env:
- LC_ALL: "C.UTF-8"
- require_in:
- pkg: php_from_ppa
pkg.latest:
- name: {{ php.php_pkg }}
- refresh: True
{%- endif %}
{%- endif %}
php:
pkg.installed:
- name: {{ php.php_pkg }}
{%- endif %}
{% set state = 'php' %}
{% include "php/installed.jinja" %}

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# vim: ft=jinja
{# Template for installing packages #}
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/macro.jinja" import sls_block %}
{% from "php/map.jinja" import php with context %}
{% from "php/macro.jinja" import sls_block %}
{% set pkginfo = php.lookup.pkgs.get(state) %}
@ -89,7 +89,7 @@ php_ppa_{{ state }}:
{% elif grains['os_family'] == "RedHat" and (state == 'cli' or state == 'fpm' or state == 'php') %}
{% set use_scl_repo = salt['pillar.get']('php:use_scl_repo', False) %}
{% set scl_php_version = salt['pillar.get']('php:scl_php_version', 71) %}
{% set enable_php_repo = salt['pillar.get']('php:ng:lookup:enable_php_repo', False) %}
{% set enable_php_repo = salt['pillar.get']('php:lookup:enable_php_repo', False) %}
{% if use_scl_repo and grains['os'] == 'CentOS' %}
php_centos_scl_enable_{{ state }}:
pkg.installed:

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-intl:
pkg.installed:
- name: {{ php.intl_pkg }}
{% set state = 'intl' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-json:
pkg.installed:
- name: {{ php.json_pkg }}
{% set state = 'json' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-ldap:
pkg.installed:
- name: {{ php.ldap_pkg }}
{% set state = 'ldap' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-mail:
pkg.installed:
- name : {{ php.mail_pkg }}
{% set state = 'mail' %}
{% include "php/installed.jinja" %}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-mbstring:
pkg.installed:
- name: {{ php.mbstring_pkg }}
{% set state = 'mbstring' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-mcrypt:
pkg.installed:
- name: {{ php.mcrypt_pkg }}
{% set state = 'mcrypt' %}
{% include "php/installed.jinja" %}

2
php/mdb2/init.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'mdb2' %}
{% include "php/installed.jinja" %}

3
php/mdb2/mysql.sls Normal file
View File

@ -0,0 +1,3 @@
{% set state = 'mdb2-driver-mysql' %}
{% include "php/installed.jinja" %}
{% include "php/mdb2/init.sls" %}

3
php/mdb2/pgsql.sls Normal file
View File

@ -0,0 +1,3 @@
{% set state = 'mdb2-driver-pgsql' %}
{% include "php/installed.jinja" %}
{% include "php/mdb2/init.sls" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-memcache:
pkg.installed:
- name: {{ php.memcache_pkg }}
{% set state = 'memcache' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-memcached:
pkg.installed:
- name: {{ php.memcached_pkg }}
{% set state = 'memcached' %}
{% include "php/installed.jinja" %}

23
php/modules.sls Normal file
View File

@ -0,0 +1,23 @@
{% from "php/map.jinja" import php with context %}
{% set modules = salt['pillar.get']('php:modules') or [] %}
{% set base_name = 'php.' %}
{% set existing_states = salt['cp.list_states']() %}
{% set includes = [] %}
{% set install = [] %}
{% for module in modules %}
{% set state = base_name ~ module %}
{% if state in existing_states %}
{% do includes.append(state) %}
{% else %}
{% do install.append(module) %}
{% endif %}
{% endfor %}
include: {{ includes|json }}
{% for state in install %}
{% include "php/installed.jinja" %}
{% endfor %}

View File

@ -1,43 +1,2 @@
{%- from "php/map.jinja" import php with context %}
{%- set version = salt['pillar.get']('php:mongo_version', none) %}
include:
- php.deprecated
- php
- php.xml
- php.dev
- php.pear
php-mongo:
pecl.installed:
- name: {{ php.mongo_pecl }}
- defaults: True
{%- if version is not none %}
- version: {{ version }}
{%- endif %}
- require:
- pkg: {{ php.pear_pkg }}
- pkg: build_pkgs
build_pkgs:
pkg.installed:
- pkgs: {{ php.build_pkgs }}
php-mongo-conf:
file.managed:
- name: {{ php.ext_conf_path }}/mongo.ini
- contents: |
extension={{ php.mongo_ext }}
- require:
- pkg: {{ php.php_pkg }}
{%- if salt['grains.get']('os_family') == "Debian" %}
php-mongo-enable:
cmd.run:
- name: {{ php.phpenmod_command }} mongo
- require:
- file: php-mongo-conf
{%- endif %}
{% set state = 'mongo' %}
{% include "php/installed.jinja" %}

2
php/mongodb.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'mongodb' %}
{% include "php/installed.jinja" %}

2
php/msgpack.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'msgpack' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-mysql:
pkg.installed:
- name: {{ php.mysql_pkg }}
{% set state = 'mysql' %}
{% include "php/installed.jinja" %}

View File

@ -1,9 +1,2 @@
{%- from "php/map.jinja" import php with context %}
include:
- php.deprecated
- php
php-mysqlnd:
pkg.installed:
- name: {{ php.mysqlnd_pkg }}
{% set state = 'mysqlnd' %}
{% include "php/installed.jinja" %}

2
php/net-smtp.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'net-smtp' %}
{% include "php/installed.jinja" %}

2
php/net4.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'net4' %}
{% include "php/installed.jinja" %}

9
php/net6.sls Normal file
View File

@ -0,0 +1,9 @@
{% if salt['grains.get']('os_family') == "RedHat" %}
{#
Installation of this PEAR module can be done by running
`pear install Net_IPv6` on RedHat based distros
#}
{% else %}
{% set state = 'net6' %}
{% include "php/installed.jinja" %}
{% endif %}

View File

@ -1,2 +1,2 @@
{% set state = 'adodb' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,12 +1,2 @@
# Manages the main Apache2 ini file
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
{% set settings = php.ini.defaults %}
{% do settings.update(php.apache2.ini.settings) %}
include:
- php.ng.deprecated
php_apache2_ini:
{{ php_ini(php.lookup.apache2.ini, php.apache2.ini.opts, settings) }}
- php.deprecated

View File

@ -1,14 +1,2 @@
{% if grains['os_family'] in ["Debian", "FreeBSD"] %}
include:
- php.ng.deprecated
- php.ng.apache2.install
{% endif %} #END: os = Debian|FreeBSD
{% if grains['os_family'] == "Debian" %}
- php.ng.apache2.ini
extend:
php_apache2_ini:
file:
- require:
- sls: php.ng.apache2.install
{% endif %} #END: os = debian
- php.deprecated

View File

@ -1,21 +1,2 @@
{% from "php/ng/map.jinja" import php with context %}
include:
- php.ng.deprecated
{% set state = 'apache2' %}
{% include "php/ng/installed.jinja" %}
{% if grains['os_family'] == "FreeBSD" %}
{{ php.lookup.apache2.module_config }}:
file.managed:
- source: salt://php/ng/apache2/files/mod_php.conf.jinja
- template: jinja
{% if salt['pillar.get']('php:ng:use_apache_formula', True) %}
- makedirs: true
- require_in:
- sls: apache
- watch_in:
- module: apache-restart
{% endif %} #END: use apache formula
{% endif %} #END: os = debian
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'apc' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'apcu' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'auth-sasl' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'bcmath' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'bz2' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'cache-lite' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'cgi' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,29 +1,2 @@
# Manages the php cli main ini file
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
include:
- php.ng.deprecated
{% set settings = php.ini.defaults %}
{% for key, value in php.cli.ini.settings.items() %}
{% if settings[key] is defined %}
{% do settings[key].update(value) %}
{% else %}
{% do settings.update({key: value}) %}
{% endif %}
{% endfor %}
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% for version in pillar_php_ng_version %}
{% set first_version = pillar_php_ng_version[0]|string %}
{% set ini = php.lookup.cli.ini|replace(first_version, version) %}
php_cli_ini_{{ version }}:
{{ php_ini(ini, php.cli.ini.opts, settings) }}
{% endfor %}
{% else %}
php_cli_ini:
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
{% endif %}
- php.deprecated

View File

@ -1,23 +1,2 @@
# Installs php-cli and manages the associated php.ini
include:
- php.ng.deprecated
- php.ng.cli.install
- php.ng.cli.ini
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
extend:
{% for version in pillar_php_ng_version %}
php_cli_ini_{{ version }}:
file:
- require:
- sls: php.ng.cli.install
{% endfor %}
{% else %}
extend:
php_cli_ini:
file:
- require:
- sls: php.ng.cli.install
{% endif %}
- php.deprecated

View File

@ -1,31 +1,2 @@
{% set state = 'cli' %}
{% include "php/ng/installed.jinja" %}
include:
- php.ng.deprecated
{%- if salt['grains.get']('os_family') == "Debian" %}
{% set current_php = salt['alternatives.show_current']('php') %}
{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %}
{% if 'alternatives_version' in salt['pillar.get']('php:ng') %}
{% set phpng_version = salt['pillar.get']('php:ng:alternatives_version') %}
{% else %}
{% set phpng_version = false %}
{% endif %}
{% else %}
{% set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}
{% endif %}
{% if phpng_version %}
php_{{ phpng_version }}_link:
alternatives.set:
- name: php
- path: /usr/bin/php{{ phpng_version }}
- require_in:
- pkg: php_install_{{ state }}
- onlyif:
- which php
- test {{ current_php }} != $(which php{{ phpng_version }})
{% endif %}
{% endif %}
- php.deprecated

View File

@ -1,62 +1,2 @@
{% from "php/ng/map.jinja" import php with context %}
{% set install_file = php.lookup.pkgs.local_bin + '/' + php.lookup.pkgs.composer_bin %}
{% if not salt['config.get']('sudo_user') %}
{% set salt_user = salt['config.get']('user', 'root') %}
{% else %}
{% set salt_user = salt['config.get']('sudo_user', 'root') %}
{% endif %}
{% set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
include:
- php.ng.deprecated
- php.ng
{% if grains['os_family'] == 'FreeBSD' %}
- php.ng.filter
- php.ng.hash
- php.ng.json
- php.ng.mbstring
- php.ng.openssl
- php.ng.phar
{% endif %}
get-composer:
file.managed:
- name: {{ php.lookup.pkgs.temp_dir }}/installer
- mode: 0755
- unless: test -f {{ install_file }}
- source: https://getcomposer.org/installer
- source_hash: https://composer.github.io/installer.sig
- require:
- pkg: php
install-composer:
cmd.run:
- name: php {{ php.lookup.pkgs.temp_dir }}/installer --filename={{ php.lookup.pkgs.composer_bin }} --install-dir={{ php.lookup.pkgs.local_bin }}
- unless: test -f {{ install_file }}
- env:
- HOME: {{ salt_user_home }}
- require:
- file: get-composer
# Get composer version date and check if older than 60day (defaultvalue of COMPOSER_DEV_WARNING_TIME)
# then it's time to run `composer selfupdate`
#
# It would be nice if composer had a command line switch to get this, but it doesn't,
# and so we just grep for it.
#
update-composer:
cmd.run:
- name: "{{ install_file }} selfupdate"
{% if grains['os_family'] == 'FreeBSD' %}
- unless: test $(date -v+60d -j -f "%Y-%m-%d %H:%M:%S" "$({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s")
{% else %}
- unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s")
{% endif %}
- cwd: {{ php.lookup.pkgs.local_bin }}
- env:
- HOME: {{ salt_user_home }}
- require:
- cmd: install-composer
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'console-table' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'ctype' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'curl' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'dba' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Evaluating as `False` by default, using this method since `defaults.yaml` not available in this repo #}
{%- if not salt['config.get']('php').get('warning_messages', {}).get('v1.0.0', {}).get('mute_upcoming', False) %}
php-deprecated-in-v1.0.0-test-succeed:
test.succeed_without_changes:
- name: |
################################################################################
# #
# WARNING: BREAKING CHANGES IN UPCOMING VERSION `v1.0.0` #
# #
################################################################################
# #
# This formula currently provides two methods for managing PHP; the old method #
# under `php` and the new method under `php.ng`. In upcoming `v1.0.0`, the old #
# method will be removed and `php.ng` will be promoted to `php` in its place. #
# #
# If you are not in a position to migrate, you will need to pin your repo to #
# the final release tag before `v1.0.0`, which is expected to be `v0.40.1`. #
# #
# If you are currently using `php.ng`, there is nothing to do until `v1.0.0` #
# is released. #
# #
# To migrate from the old `php`, the first step is to convert to `php.ng`, #
# before `v1.0.0` is released. #
# #
# To prevent this message being displayed again, set the pillar/config value: #
# #
# ``` #
# php: #
# warning_messages: #
# v1.0.0: #
# mute_upcoming: True #
# ``` #
# #
################################################################################
{%- endif %}

View File

@ -1,2 +1,2 @@
{% set state = 'dev' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'dom' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

View File

@ -1,2 +1,2 @@
{% set state = 'fileinfo' %}
{% include "php/ng/installed.jinja" %}
include:
- php.deprecated

Some files were not shown because too many files have changed in this diff Show More