aboutsummaryrefslogtreecommitdiffstats
path: root/modules/phpbb/files/phpbb_apply_config.pl
blob: fd0282d106d6b764f76aac7022d946070abe30a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 $?";
}