From 2cb1563f63386b35a69e460051aa9b4a2851d104 Mon Sep 17 00:00:00 2001 From: ftimme <ft@falkotimme.com> Date: Wed, 30 May 2012 07:30:44 -0400 Subject: [PATCH] - Added (clickable) placeholders to client messaging function. - Added check so that the client password isn't inserted into the message (for security reasons). --- server/scripts/vlogger | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/server/scripts/vlogger b/server/scripts/vlogger index d136af1..858617d 100755 --- a/server/scripts/vlogger +++ b/server/scripts/vlogger @@ -28,6 +28,7 @@ # 1.1 bugfix release # 1.2 support for mod_logio # 1.3 various contributed bugfixes +# 1.3ISPconfig1 This local version has been modified for ISPConfig. Namely: "Added better error handling to vlogger script in case the MySQL database connection is not available." # # # TODO: @@ -252,9 +253,14 @@ } # test the connection - my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS ) - or die "DBI Error: $!"; - $dbh->disconnect; + eval { + my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS ) + or die "DBI Error: $!"; + $dbh->disconnect; + }; + if ($@) { + print "MySQL Connection problem\n"; + } # SIGALRM dumps the tracker hash $SIG{ALRM} = \&dump_tracker; @@ -503,7 +509,8 @@ # sub to update the database with the tracker data sub dump_tracker { - if ( keys(%tracker) > 0 ) { + eval { + if ( keys(%tracker) > 0 ) { my $dbh = DBI->connect( $DBI_DSN, $DBI_USER, $DBI_PASS ) or warn "DBI Error: $!"; foreach my $key ( keys(%tracker) ) { @@ -529,6 +536,10 @@ %tracker = (); } alarm $DBI_DUMP; + }; + if ($@) { + print "Unable to store vlogger data in database\n"; + } } # print usage info -- Gitblit v1.9.1