view modules/website/manifests/php.pp @ 263:f99974dc0f1a

Add a way to skip setting CSP NextCloud manages CSP itself, so we don't need the header in the PIM subdomain causing confusion and incorrect results
author IBBoard <dev@ibboard.co.uk>
date Sun, 29 Dec 2019 16:43:55 +0000
parents c3fa3d65aa83
children 99e3ca448d55
line wrap: on
line source

class website::php(
    $suffix = '',
    $opcache = undef,
    $extras = [],
    ) {
  Package <| tag == 'php-package' |> -> File <| tag == 'php-file' |> ~> Service['httpd']

  if $suffix =~ /^7[1-9]w$/ {
    $php_core = "mod_php${suffix}"
  } else {
    $php_core = "php${suffix}"
  }

  $packages = [ $php_core, "php${suffix}-mbstring", "php${suffix}-xml", "php${suffix}-gd" ]
  package { $packages:
    ensure => installed,
    tag => 'php-package',
  }

  file { '/etc/php.d/custom-lockdown.ini':
    ensure => present,
    content => 'allow_url_fopen = \'off\'
    expose_php = Off',
    tag => 'php-file',
  }
  file { '/etc/php.d/custom-php.ini':
    ensure => present,
    source => 'puppet:///modules/website/custom-php.ini',
    tag => 'php-file',
  }

  if $opcache {
    package { "php${suffix}-${opcache}":
      ensure => installed,
      require => Package[$php_core],
      tag => 'php-package',
    }
    # Use Remi's (and the OS's) naming convention
    file { '/etc/php.d/opcache.ini':
      ensure => absent,
    }
    file { '/etc/php.d/10-opcache.ini':
      ensure => present,
      source => 'puppet:///modules/website/opcache.ini',
      tag => 'php-file',
    }
  }
}