Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch from bta

  • Loading branch information...
commit 7461c79bc9f30f1240810d4760153dd89710a7e9 2 parents 1b8d0e7 + 317a839
@chancemedia chancemedia authored
Showing with 22 additions and 5 deletions.
  1. +8 −0 README
  2. +7 −1 backend/mysql.pl
  3. +7 −4 src/functions.pl
View
8 README
@@ -0,0 +1,8 @@
+Please edit settings.pl to match your environment.
+Run ./init.pl
+
+You may need to install the following CPAN modules in order to proceed:
+perl -MCPAN -e 'install LWP::UserAgent'
+perl -MCPAN -e 'install DBI'
+perl -MCPAN -e 'install DBD:mysql'
+
View
8 backend/mysql.pl
@@ -1,10 +1,16 @@
+use DBI;
+use DBD::mysql;
+
# mbz_connect()
# Make database connection. It will set the global $dbh and it will return it.
# $g_db_name, $g_db_host, $g_db_port, $g_db_user and $g_db_pass are supplied by settings.pl.
# @return $dbh
sub backend_mysql_connect {
- $dbh = DBI->connect("dbi:mysql:dbname=$g_db_name;host=$g_db_host;port=$g_db_port",
+ $dbh = DBI->connect("dbi:mysql:dbname=$g_db_name;host=$g_db_host;port=$g_db_port;mysql_local_infile=1;",
$g_db_user, $g_db_pass);
+
+ $dbh || die 'Unable to connect to the database: ' . $DBI::errstr;
+
return $dbh;
}
View
11 src/functions.pl
@@ -106,10 +106,13 @@ sub mbz_download_file {
my $ua = LWP::UserAgent->new();
my $request = HTTP::Request->new('GET', $_[0]);
my $resp = $ua->request($request, $_[1]);
-
- die("Request to download \"$_[0]\" failed. Quitting.\n") if(!$resp->is_success);
-
- return $resp;
+<<<<<<< HEAD
+ if($resp->is_success) {
+ return $resp;
+ } else {
+ die 'Error downloading ' . $_[0] . ': ' . $resp->status_line;
+ }
+>>>>>>> 317a8399c9472b31109b65d1d83a9857e01a65d7
}
Please sign in to comment.
Something went wrong with that request. Please try again.