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 <kevin@kevinlocke.name>
This commit is contained in:
Kevin Locke
2016-08-22 18:21:10 -06:00
parent bb7c8076a0
commit 68d8ead5ad

View File

@ -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