Permalink
Browse files

add config options for MySQL compressed and encrypted connections

add support for MySQL compressed and encrypted connections

Pass compress and secure configs to database instance

Revert "add config options for MySQL compressed and encrypted connections"

This reverts commit cdb59c2.

Revert "add config options for MySQL compressed and encrypted connections"

This reverts commit cdb59c2.
  • Loading branch information...
1 parent fdbb8ec commit 7a1908b4eae9d60bee89b3cc44d793c2cf94c1e5 @KyraD KyraD committed with Sep 10, 2013
Showing with 13 additions and 3 deletions.
  1. +5 −1 classes/Pommo.php
  2. +2 −2 classes/Pommo_Db.php
  3. +6 −0 config.sample.php
View
@@ -189,10 +189,14 @@ public static function preInit($baseDir)
self::$_section = preg_replace('@^admin/?@i', '',
str_replace(self::$_baseUrl, '', dirname($_SERVER['PHP_SELF'])));
+ $db_conn_compress = (strtolower($config['db_conn_compress']) != 'on') ? 0 : MYSQL_CLIENT_COMPRESS;
+ $db_conn_secure = (strtolower($config['db_conn_secure']) != 'on') ? 0 : MYSQL_CLIENT_SSL;
+
// initialize database link
self::$_dbo = @new Pommo_Db($config['db_username'],
$config['db_password'], $config['db_database'],
- $config['db_hostname'], $config['db_prefix']);
+ $config['db_hostname'], $config['db_prefix'],
+ $db_conn_compress, $db_conn_secure);
// turn off debugging if in user area
if(self::$_section == 'user')
View
@@ -40,7 +40,7 @@ class Pommo_Db
var $_results; // array holding unique results (for use with executing queries within loops & not overwriting the loops conditional resultset)
function Pommo_Db($username = NULL, $password = NULL, $database = NULL,
- $hostname = NULL, $tablePrefix = NULL)
+ $hostname = NULL, $tablePrefix = NULL, $compress = 0, $secure = 0)
{
// turn off magic quotes runtime
if (get_magic_quotes_runtime())
@@ -81,7 +81,7 @@ function Pommo_Db($username = NULL, $password = NULL, $database = NULL,
// connect to mysql database using config variables from poMMo class (set in setup/config.php).
// supress errors to hide login information...
- $this->_link = mysql_connect($hostname, $username, $password);
+ $this->_link = mysql_connect($hostname, $username, $password, false, $compress | $secure);
if (!$this->_link)
Pommo::kill(Pommo::_T('Could not establish database connection.').' '.Pommo::_T('Verify your settings in config.php'));
View
@@ -27,6 +27,12 @@
[db_prefix] = "pommo_"
Change if you intend to have multiple poMMos running from the same database
+[db_conn_compress] = off
+ Enable (on) or disable(off). Use compression protocol for connection
+
+[db_conn_secure] = off
+ Enable (on) or disable(off). Use SSL encryption when connecting to database
+
::: Language Information :::

0 comments on commit 7a1908b

Please sign in to comment.