jenkins-bot has submitted this change and it was merged.

Change subject: Use php::ini resource type
......................................................................


Use php::ini resource type

This change revises the Puppet code introduced by change I1340609de, making it
use the php::ini resource type rather than doing things the hard way.

Change-Id: Idf51b30c9f9db2a429dac8cb7524f7d6432210fe
---
M puppet/manifests/roles.pp
D puppet/modules/mediawiki/templates/php-development-settings.ini
M puppet/modules/php/manifests/ini.pp
M puppet/modules/php/manifests/init.pp
M puppet/modules/php/templates/conffile.ini.erb
5 files changed, 15 insertions(+), 47 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/manifests/roles.pp b/puppet/manifests/roles.pp
index 344fee1..a880f04 100644
--- a/puppet/manifests/roles.pp
+++ b/puppet/manifests/roles.pp
@@ -64,7 +64,6 @@
                upload_dir   => $upload_dir,
                server_url   => $server_url,
        }
-
 }
 
 # == Class: role::fundraising
diff --git a/puppet/modules/mediawiki/templates/php-development-settings.ini 
b/puppet/modules/mediawiki/templates/php-development-settings.ini
deleted file mode 100644
index de90272..0000000
--- a/puppet/modules/mediawiki/templates/php-development-settings.ini
+++ /dev/null
@@ -1,38 +0,0 @@
-; This directive controls whether or not and where PHP will output errors,
-; notices and warnings too. Error output is very useful during development, but
-; it could be very dangerous in production environments. Depending on the code
-; which is triggering the error, sensitive information could potentially leak
-; out of your application such as database usernames and passwords or worse.
-; It's recommended that errors be logged on production servers rather than
-; having the errors sent to STDOUT.
-; Possible Values:
-;   Off = Do not display any errors
-;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
-;   On or stdout = Display errors to STDOUT
-; Default Value: On
-; Development Value: On
-; Production Value: Off
-; http://php.net/display-errors
-display_errors = On
-
-; The display of errors which occur during PHP's startup sequence are handled
-; separately from display_errors. PHP's default behavior is to suppress those
-; errors from clients. Turning the display of startup errors on can be useful 
in
-; debugging configuration problems. But, it's strongly recommended that you
-; leave this setting off on production servers.
-; Default Value: Off
-; Development Value: On
-; Production Value: Off
-; http://php.net/display-startup-errors
-display_startup_errors = On
-
-; Common Values:
-;   E_ALL (Show all errors, warnings and notices including coding standards.)
-;   E_ALL & ~E_NOTICE  (Show all errors, except for notices)
-;   E_ALL & ~E_NOTICE & ~E_STRICT  (Show all errors, except for notices and 
coding standards warnings.)
-;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only 
errors)
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
-; Development Value: -1 (All errors future and present)
-; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
-; http://php.net/error-reporting
-error_reporting = -1
diff --git a/puppet/modules/php/manifests/ini.pp 
b/puppet/modules/php/manifests/ini.pp
index a4eeb48..19efae4 100644
--- a/puppet/modules/php/manifests/ini.pp
+++ b/puppet/modules/php/manifests/ini.pp
@@ -38,13 +38,14 @@
 
 #
 define php::ini (
-    $settings,
+       $settings,
        $ensure = present,
 ) {
        include php
        include apache
 
-       file { "/etc/php5/conf.d/${name}.ini":
+       $basename = inline_template('<%= @title.gsub(/\W/, "-").downcase %>')
+       file { "/etc/php5/conf.d/${basename}.ini":
                ensure  => $ensure,
                content => template('php/conffile.ini.erb'),
                require => Package['php5'],
diff --git a/puppet/modules/php/manifests/init.pp 
b/puppet/modules/php/manifests/init.pp
index 4fae3c8..6ceb3b2 100644
--- a/puppet/modules/php/manifests/init.pp
+++ b/puppet/modules/php/manifests/init.pp
@@ -5,6 +5,8 @@
 # implemented.
 #
 class php {
+       include apache
+
        package { [
                'php5',
                'php-apc',
@@ -21,14 +23,15 @@
                ensure => present,
        }
 
-       include apache
        @apache::mod { 'php5':
                ensure => present,
        }
 
-       file { '/etc/php5/conf.d/development.ini':
-               ensure => present,
-               content => template('mediawiki/php-development-settings.ini'),
-               notify => Service['apache2'],
+       php::ini { 'debug output':
+               settings => {
+                       display_errors         => true,
+                       display_startup_errors => true,
+                       error_reporting        => -1,
+               }
        }
 }
diff --git a/puppet/modules/php/templates/conffile.ini.erb 
b/puppet/modules/php/templates/conffile.ini.erb
index dc749cc..dfc7ffe 100644
--- a/puppet/modules/php/templates/conffile.ini.erb
+++ b/puppet/modules/php/templates/conffile.ini.erb
@@ -3,7 +3,10 @@
 <%=
 case @settings
 when Hash
-    @settings.sort.map { |k,v| "#{k} = #{v}" }.join("\n")
+    @settings.sort.map { |k,v|
+        v = v ? 1 : 0 if [TrueClass, FalseClass].include? v.class
+        %Q(#{k} = "#{v.inspect}")
+    }.join("\n")
 when Array
     @settings.join("\n")
 else

-- 
To view, visit https://gerrit.wikimedia.org/r/72349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf51b30c9f9db2a429dac8cb7524f7d6432210fe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to