Commit c84a6d59 authored by tbrehm's avatar tbrehm
Browse files

Added: FS#1691 - Add support for mysql flags like MYSQL_CLIENT_SSL in ISPConfig mysql library

parent 3335f3cf
...@@ -67,6 +67,8 @@ $conf['db_database'] = '{mysql_server_database}'; ...@@ -67,6 +67,8 @@ $conf['db_database'] = '{mysql_server_database}';
$conf['db_user'] = '{mysql_server_ispconfig_user}'; $conf['db_user'] = '{mysql_server_ispconfig_user}';
$conf['db_password'] = '{mysql_server_ispconfig_password}'; $conf['db_password'] = '{mysql_server_ispconfig_password}';
$conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1") $conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
$conf['db_new_link'] = false;
$conf['db_client_flags'] = 0;
define('DB_TYPE',$conf['db_type']); define('DB_TYPE',$conf['db_type']);
define('DB_HOST',$conf['db_host']); define('DB_HOST',$conf['db_host']);
...@@ -82,6 +84,8 @@ $conf['dbmaster_host'] = '{mysql_master_server_host}'; ...@@ -82,6 +84,8 @@ $conf['dbmaster_host'] = '{mysql_master_server_host}';
$conf['dbmaster_database'] = '{mysql_master_server_database}'; $conf['dbmaster_database'] = '{mysql_master_server_database}';
$conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}'; $conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}';
$conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}'; $conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}';
$conf['dbmaster_new_link'] = false;
$conf['dbmaster_client_flags'] = 0;
//** Paths //** Paths
......
...@@ -33,6 +33,8 @@ class db { ...@@ -33,6 +33,8 @@ class db {
private $dbUser = ''; // database authorized user private $dbUser = ''; // database authorized user
private $dbPass = ''; // user's password private $dbPass = ''; // user's password
private $dbCharset = ''; // what charset comes and goes to mysql: utf8 / latin1 private $dbCharset = ''; // what charset comes and goes to mysql: utf8 / latin1
private $dbNewLink = false; // Return a new linkID when connect is called again
private $dbClientFlags = 0; // MySQL Client falgs
private $linkId = 0; // last result of mysql_connect() private $linkId = 0; // last result of mysql_connect()
private $queryId = 0; // last result of mysql_query() private $queryId = 0; // last result of mysql_query()
private $record = array(); // last record fetched private $record = array(); // last record fetched
...@@ -51,6 +53,8 @@ class db { ...@@ -51,6 +53,8 @@ class db {
$this->dbUser = $conf['db_user']; $this->dbUser = $conf['db_user'];
$this->dbPass = $conf['db_password']; $this->dbPass = $conf['db_password'];
$this->dbCharset = $conf['db_charset']; $this->dbCharset = $conf['db_charset'];
$this->dbNewLink = $conf['db_new_link'];
$this->dbClientFlags = $conf['db_client_flags'];
//$this->connect(); //$this->connect();
} }
...@@ -69,7 +73,7 @@ class db { ...@@ -69,7 +73,7 @@ class db {
public function connect() public function connect()
{ {
if($this->linkId == 0){ if($this->linkId == 0){
$this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbNewLink, $this->dbClientFlags);
if(!$this->linkId){ if(!$this->linkId){
$this->updateError('DB::connect()<br />mysql_connect'); $this->updateError('DB::connect()<br />mysql_connect');
return false; return false;
......
...@@ -54,6 +54,8 @@ $conf['db_database'] = 'ispconfig3'; ...@@ -54,6 +54,8 @@ $conf['db_database'] = 'ispconfig3';
$conf['db_user'] = 'root'; $conf['db_user'] = 'root';
$conf['db_password'] = ''; $conf['db_password'] = '';
$conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1") $conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
$conf['db_new_link'] = false;
$conf['db_client_flags'] = 0;
define('DB_TYPE',$conf['db_type']); define('DB_TYPE',$conf['db_type']);
define('DB_HOST',$conf['db_host']); define('DB_HOST',$conf['db_host']);
...@@ -69,6 +71,8 @@ $conf['dbmaster_host'] = '{mysql_master_server_host}'; ...@@ -69,6 +71,8 @@ $conf['dbmaster_host'] = '{mysql_master_server_host}';
$conf['dbmaster_database'] = '{mysql_master_server_database}'; $conf['dbmaster_database'] = '{mysql_master_server_database}';
$conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}'; $conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}';
$conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}'; $conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}';
$conf['dbmaster_new_link'] = false;
$conf['dbmaster_client_flags'] = 0;
//** Paths //** Paths
......
...@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -34,6 +34,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var $dbUser = ''; // database authorized user var $dbUser = ''; // database authorized user
var $dbPass = ''; // user's password var $dbPass = ''; // user's password
var $dbCharset = 'utf8';// Database charset var $dbCharset = 'utf8';// Database charset
var $dbNewLink = false; // Return a new linkID when connect is called again
var $dbClientFlags = 0; // MySQL Client falgs
var $linkId = 0; // last result of mysql_connect() var $linkId = 0; // last result of mysql_connect()
var $queryId = 0; // last result of mysql_query() var $queryId = 0; // last result of mysql_query()
var $record = array(); // last record fetched var $record = array(); // last record fetched
...@@ -53,6 +55,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -53,6 +55,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$this->dbUser = $conf['db_user']; $this->dbUser = $conf['db_user'];
$this->dbPass = $conf['db_password']; $this->dbPass = $conf['db_password'];
$this->dbCharset = $conf['db_charset']; $this->dbCharset = $conf['db_charset'];
$this->dbNewLink = $conf['db_new_link'];
$this->dbClientFlags = $conf['db_client_flags'];
//$this->connect(); //$this->connect();
} }
...@@ -79,7 +83,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -79,7 +83,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{ {
if($this->linkId == 0) if($this->linkId == 0)
{ {
$this->linkId = @mysql_connect($this->dbHost, $this->dbUser, $this->dbPass); $this->linkId = @mysql_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbNewLink, $this->dbClientFlags);
if(!$this->linkId) if(!$this->linkId)
{ {
$this->updateError('DB::connect()-> mysql_connect'); $this->updateError('DB::connect()-> mysql_connect');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment