aboutsummaryrefslogtreecommitdiffstats
path: root/modules/phpbb/files
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-04-19 12:46:07 +0000
committerMichael Scherer <misc@mageia.org>2011-04-19 12:46:07 +0000
commitd094f9770e1bc88635374fb649f642c3f1deab7c (patch)
tree964209e7953df373a4da91670d3fb9cff20207ec /modules/phpbb/files
parentacf0e88ecf4fa46e52099900a22cc3b69c6a4381 (diff)
downloadpuppet-d094f9770e1bc88635374fb649f642c3f1deab7c.tar
puppet-d094f9770e1bc88635374fb649f642c3f1deab7c.tar.gz
puppet-d094f9770e1bc88635374fb649f642c3f1deab7c.tar.bz2
puppet-d094f9770e1bc88635374fb649f642c3f1deab7c.tar.xz
puppet-d094f9770e1bc88635374fb649f642c3f1deab7c.zip
use a transaction and close the database, maybe this will help to avoid
the timeout problem I see from time to time
Diffstat (limited to 'modules/phpbb/files')
-rw-r--r--modules/phpbb/files/phpbb_apply_config.pl10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/phpbb/files/phpbb_apply_config.pl b/modules/phpbb/files/phpbb_apply_config.pl
index 8c776ce5..5bd094e4 100644
--- a/modules/phpbb/files/phpbb_apply_config.pl
+++ b/modules/phpbb/files/phpbb_apply_config.pl
@@ -8,10 +8,15 @@ my $key = $ARGV[0];
# DBI will use default value coming from env
# see puppet manifests
-my $dbh = DBI->connect("dbi:Pg:","","");
+my $dbh = DBI->connect("dbi:Pg:","","", {
+ AutoCommit => 0,
+ RaiseError => 1,
+});
my $table = "phpbb_config";
+# FIXME add rollback if there is a problem
+# http://docstore.mik.ua/orelly/linux/dbi/ch06_03.htm
my $update = $dbh->prepare("UPDATE $table SET config_value = ?, is_dynamic = ? WHERE config_name = ?");
my $insert = $dbh->prepare("INSERT INTO $table ( config_value, is_dynamic, config_name ) VALUES ( ? , ? , ? )");
@@ -19,4 +24,5 @@ my $res = $update->execute($VALUE, 1, $key) or die "cannot do update $?";
if ($res == 0 ) {
$insert->execute($VALUE, 1, $key) or die "cannot do insert $?";
}
-
+$dbh->commit();
+$dbh->disconnect();