From 68d8ead5adec822d37d95aed012eefb3447ea04b Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 22 Aug 2016 18:21:10 -0600 Subject: [PATCH] Partially revert 650f768 Although calling wpsql_select_db from wpsql_connect did set the connection globally, it also caused early clearing of the connection string when WP_INSTALLING is defined and ran queued early SQL commands before select is called by external code (which was dubious). Revert it, but keep using the best guess at the database name, since this often saves a connection. Signed-off-by: Kevin Locke --- pg4wp/driver_pgsql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 945c87c..0536b95 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -82,7 +82,7 @@ // PostgreSQL must connect to a specific database (unlike MySQL) // Guess at one here and reconnect as required in wpsql_select_db $dbname = defined('DB_NAME') && DB_NAME ? DB_NAME : 'template1'; - return wpsql_select_db( $dbname); + return pg_connect( $GLOBALS['pg4wp_connstr'].' dbname='.$dbname); } // The effective connection happens here