diff options
Diffstat (limited to 'modules/phpbb/files/phpbb_apply_config.pl')
-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 $?"; +} + |