mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-31 10:17:13 +02:00
fix caompatibility with WordPress 4.6
This commit is contained in:
@ -26,6 +26,11 @@
|
|||||||
$GLOBALS['pg4wp_connstr'] = '';
|
$GLOBALS['pg4wp_connstr'] = '';
|
||||||
$GLOBALS['pg4wp_conn'] = false;
|
$GLOBALS['pg4wp_conn'] = false;
|
||||||
|
|
||||||
|
|
||||||
|
function wpsql_ping($conn) {
|
||||||
|
return(pg_ping($conn));
|
||||||
|
}
|
||||||
|
|
||||||
function wpsql_num_rows($result)
|
function wpsql_num_rows($result)
|
||||||
{ return pg_num_rows($result); }
|
{ return pg_num_rows($result); }
|
||||||
function wpsql_numrows($result)
|
function wpsql_numrows($result)
|
||||||
@ -77,12 +82,9 @@
|
|||||||
elseif( !PG4WP_INSECURE)
|
elseif( !PG4WP_INSECURE)
|
||||||
wp_die( 'Connecting to your PostgreSQL database without a password is considered insecure.
|
wp_die( 'Connecting to your PostgreSQL database without a password is considered insecure.
|
||||||
<br />If you want to do it anyway, please set "PG4WP_INSECURE" to true in your "db.php" file.' );
|
<br />If you want to do it anyway, please set "PG4WP_INSECURE" to true in your "db.php" file.' );
|
||||||
|
|
||||||
// While installing, we test the connection to 'template1' (as we don't know the effective dbname yet)
|
// as of WordPress 4.6, a true resource must be returned
|
||||||
if( defined('WP_INSTALLING') && WP_INSTALLING)
|
return pg_connect( $GLOBALS['pg4wp_connstr'].' dbname=template1');
|
||||||
return wpsql_select_db( 'template1');
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The effective connection happens here
|
// The effective connection happens here
|
||||||
|
Reference in New Issue
Block a user