WordPress.org

Ready to get started?Download WordPress

Forums

PostgreSQL for WordPress (PG4WP)
[resolved] Alternative port in conection (2 posts)

  1. malguzt
    Member
    Posted 2 years ago #

    I changed driver_pgsql.php to allow an alternative port in connection. Now can connect with host:port

    function wpsql_connect($dbserver, $dbuser, $dbpass) {
    $GLOBALS['pg4wp_connstr'] = '';
    if (!empty($dbserver)) {
    $hostAndPort = explode(':', $dbserver);
    $GLOBALS['pg4wp_connstr'] .= ' host=' . $hostAndPort[0];
    if(isset($hostAndPort[1])){
    $GLOBALS['pg4wp_connstr'] .= ' port=' . $hostAndPort[1];
    }
    }

    if (!empty($dbuser))
    $GLOBALS['pg4wp_connstr'] .= ' user=' . $dbuser;
    if (!empty($dbpass))
    $GLOBALS['pg4wp_connstr'] .= ' password=' . $dbpass;
    elseif (!PG4WP_INSECURE)
    wp_die('Connecting to your PostgreSQL database without a password is considered insecure.

    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)
    if (defined('WP_INSTALLING') && WP_INSTALLING)
    return wpsql_select_db('template1');

    return 1;
    }

    http://wordpress.org/extend/plugins/postgresql-for-wordpress/

  2. hawk__
    Member
    Plugin Author

    Posted 2 years ago #

    Hi !

    You don't tell which version of PG4WP you were using, so I assume 1.2.2 (which was the latest stable version when you posted)...

    I've integrated a similar patch in PG4WP 1.3.0b1 and so the new stable version (released earlier today) has it included :)

    Anyway, thank you for your effort, please keep me informed if you have any issue using PG4WP.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.