1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Issue #1768 Partial fix for running on non-standard MySQL port. Added $mySQLport = 3306; to e107_config.php and modify as required.

This commit is contained in:
Cameron
2016-07-07 15:09:38 -07:00
parent 345bbc4ff8
commit 84d66979a4
2 changed files with 13 additions and 6 deletions

View File

@@ -226,7 +226,7 @@ e107_require_once($tmp.'/e107_class.php');
unset($tmp); unset($tmp);
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY'); $e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY','UPLOADS_DIRECTORY','SYSTEM_DIRECTORY', 'MEDIA_DIRECTORY','CACHE_DIRECTORY','LOGS_DIRECTORY', 'CORE_DIRECTORY', 'WEB_DIRECTORY');
$sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix'); $sql_info = compact('mySQLserver', 'mySQLuser', 'mySQLpassword', 'mySQLdefaultdb', 'mySQLprefix', 'mySQLport');
$e107 = e107::getInstance()->initCore($e107_paths, realpath(dirname(__FILE__)), $sql_info, varset($E107_CONFIG, array())); $e107 = e107::getInstance()->initCore($e107_paths, realpath(dirname(__FILE__)), $sql_info, varset($E107_CONFIG, array()));
e107::getSingleton('eIPHandler'); // This auto-handles bans etc e107::getSingleton('eIPHandler'); // This auto-handles bans etc

View File

@@ -69,9 +69,10 @@ class e_db_mysql
{ {
// TODO switch to protected vars where needed // TODO switch to protected vars where needed
public $mySQLserver; public $mySQLserver;
public $mySQLuser; public $mySQLuser;
protected $mySQLpassword; protected $mySQLpassword;
protected $mySQLdefaultdb; protected $mySQLdefaultdb;
protected $mySQLport = 3306;
public $mySQLPrefix; public $mySQLPrefix;
protected $mySQLaccess; protected $mySQLaccess;
public $mySQLresult; public $mySQLresult;
@@ -83,7 +84,7 @@ class e_db_mysql
protected $mySQLlastQuery = ''; protected $mySQLlastQuery = '';
public $mySQLcurTable; public $mySQLcurTable;
public $mySQLlanguage; public $mySQLlanguage;
public $mySQLinfo; public $mySQLinfo;
public $tabset; public $tabset;
public $mySQLtableList = array(); // list of all Db tables. public $mySQLtableList = array(); // list of all Db tables.
@@ -99,6 +100,7 @@ class e_db_mysql
private $pdo = false; // using PDO or not. private $pdo = false; // using PDO or not.
/** /**
* Constructor - gets language options from the cookie or session * Constructor - gets language options from the cookie or session
* @access public * @access public
@@ -113,11 +115,16 @@ class e_db_mysql
{ {
$this->pdo = true; $this->pdo = true;
} }
e107::getSingleton('e107_traffic')->BumpWho('Create db object', 1); e107::getSingleton('e107_traffic')->BumpWho('Create db object', 1);
$this->mySQLPrefix = MPREFIX; // Set the default prefix - may be overridden $this->mySQLPrefix = MPREFIX; // Set the default prefix - may be overridden
if($port = e107::getMySQLConfig('port'))
{
$this->mySQLport = intval($port);
}
/*$langid = (isset($pref['cookie_name'])) ? 'e107language_'.$pref['cookie_name'] : 'e107language_temp'; /*$langid = (isset($pref['cookie_name'])) ? 'e107language_'.$pref['cookie_name'] : 'e107language_temp';
if (isset($pref['user_tracking']) && ($pref['user_tracking'] == 'session')) if (isset($pref['user_tracking']) && ($pref['user_tracking'] == 'session'))
{ {
@@ -182,7 +189,7 @@ class e_db_mysql
{ {
try try
{ {
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=3306", $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); $this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=".$this->mySQLport, $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} }
catch(PDOException $ex) catch(PDOException $ex)
@@ -271,7 +278,7 @@ class e_db_mysql
{ {
try try
{ {
$this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=3306", $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); $this->mySQLaccess = new PDO("mysql:host=".$this->mySQLserver."; port=".$this->mySQLport, $this->mySQLuser, $this->mySQLpassword, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} }
catch(PDOException $ex) catch(PDOException $ex)
{ {