Ticket #2953: mythweb-dl.diff

File mythweb-dl.diff, 2.1 KB (added by Rob Smith, 17 years ago)
  • includes/objects/Database_mysql.php

     
    4343 * @param string $port         Port or socket address to connect to
    4444/**/
    4545    function __construct($db_name, $login, $password, $server='localhost', $port=NULL, $options=NULL) {
     46    // Attempt to make sure the extension is loaded
     47        if (!extension_loaded('mysql')) {
     48        // This function is deprecated as of php5, so we see if we can use it
     49            if (function_exists('dl')) {
     50            // Attempt to allow dl to be used
     51                ini_set('enable_dl', TRUE);
     52                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
     53                    dl('php_mysql.dll');
     54                else
     55                    dl('mysql.so');
     56            }
     57        }
    4658    // Connect to the database
    4759        $this->dbh = @mysql_connect($port ? "$server:$port" : $server, $login, $password)
    4860            or $this->error("Can't connect to the database server.");
  • includes/objects/Database_mysqli_compat.php

     
    5050 * @param string $port      Port or socket address to connect to
    5151/**/
    5252    function __construct($db_name, $login, $password, $server='localhost', $port=NULL) {
     53    // Attempt to make sure the extension is loaded
     54        if (!extension_loaded('mysql')) {
     55        // This function is deprecated as of php5, so we see if we can use it
     56            if (function_exists('dl')) {
     57            // Attempt to allow dl to be used
     58                ini_set('enable_dl', TRUE);
     59                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
     60                    dl('php_mysql.dll');
     61                else
     62                    dl('mysql.so');
     63            }
     64        }
    5365    // Connect to the database
    5466        $this->dbh = @mysqli_connect($server, $login, $password, NULL, $port)
    5567            or $this->error("Can't connect to the database server.");