diff options
author | Michael Scherer <misc@mageia.org> | 2011-02-15 00:48:24 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2011-02-15 00:48:24 +0000 |
commit | b8481f2561b8de21892e3f4b1914193d54ac4c93 (patch) | |
tree | 243999b9f406e1a89fd7b7e76b66d18fb9e93e1c /modules/phpbb/files | |
parent | 116df2e39ac697b55b11021985555b8f889d5110 (diff) | |
download | puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.gz puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.bz2 puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.tar.xz puppet-b8481f2561b8de21892e3f4b1914193d54ac4c93.zip |
add a define to manage part of the phpbb config from puppet by directly changing the configuration in the db
Diffstat (limited to 'modules/phpbb/files')
-rw-r--r-- | modules/phpbb/files/phpbb_apply_config.pl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/phpbb/files/phpbb_apply_config.pl b/modules/phpbb/files/phpbb_apply_config.pl new file mode 100644 index 00000000..fd0282d1 --- /dev/null +++ b/modules/phpbb/files/phpbb_apply_config.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Env qw(VALUE); +use DBI; + +# DBI will use default value coming from env +# see puppet manifests +my $key = $ARGV[1]; + +my $dbh = DBI->connect("dbi:Pg:","",""); + +my $table = "phpbb_config"; + +my $update = $dbh->prepare("UPDATE $table SET config_value = ? WHERE config_name = ?"); +my $insert = $dbh->prepare("INSERT INTO $table ( config_value, config_name, is_dynamic ) VALUES ( ? , ? , ? )"); + +my $res = $update->execute($VALUE ,$key) or die "cannot do update $?"; +if ($res == 0 ) { + $insert->execute($VALUE ,$key, 1) or die "cannot do insert $?"; +} + |