Changeset:
        0fe8e6c91c84
        
https://sourceforge.net/p/mrbs/hg-code/ci/0fe8e6c91c84a32c7fd1255f362fa8622e90bc4d
Author:
        John Beranek <[email protected]>
Date:
        Wed Apr 05 20:24:25 2017 +0100
Log message:

Support setting $db_host to "" (or unset), to indicate you'd like
MRBS to use the default Unix domain socket instead of TCP.
See [bugs:#384]. On Linux at least, this works for both MySQL
and PostgreSQL.

diffstat:

 web/lib/MRBS/DB.php |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r fb96328cb346 -r 0fe8e6c91c84 web/lib/MRBS/DB.php
--- a/web/lib/MRBS/DB.php       Thu Mar 30 20:44:30 2017 +0100
+++ b/web/lib/MRBS/DB.php       Wed Apr 05 20:24:25 2017 +0100
@@ -37,7 +37,15 @@
     // Establish a database connection.
     try
     {
-      $this->dbh = new 
PDO(static::DB_DBO_DRIVER.":host=$db_host;port=$db_port;dbname=$db_name",
+      if (!isset($db_host) || ($db_host == ""))
+      {
+        $hostpart = "";
+      }
+      else
+      {
+        $hostpart = "host=$db_host;";
+      }
+      $this->dbh = new 
PDO(static::DB_DBO_DRIVER.":$hostpart;port=$db_port;dbname=$db_name",
                            $db_username,
                            $db_password,
                            array(PDO::ATTR_PERSISTENT => ($persist ? true : 
false),

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to