mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Disable connection cache workaround
This commit is contained in:
parent
3f9eb61e07
commit
44b8223a5f
1 changed files with 13 additions and 13 deletions
|
@ -29,13 +29,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$PDOCache = array();
|
// $PDOCache = array();
|
||||||
|
|
||||||
class DBLayer {
|
class DBLayer {
|
||||||
|
|
||||||
private $PDO;
|
private $PDO;
|
||||||
private $host;
|
// private $host;
|
||||||
private $dbname;
|
// private $dbname;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PDO object, instantiated by the constructor
|
* The PDO object, instantiated by the constructor
|
||||||
|
@ -51,15 +51,15 @@ class DBLayer {
|
||||||
function __construct($db, $dbn = null)
|
function __construct($db, $dbn = null)
|
||||||
{
|
{
|
||||||
global $cfg;
|
global $cfg;
|
||||||
$this->host = $cfg['db'][$db]['host'];
|
// $this->host = $cfg['db'][$db]['host'];
|
||||||
$this->dbname = $cfg['db'][$db]['name'];
|
// $this->dbname = $cfg['db'][$db]['name'];
|
||||||
global $PDOCache;
|
/*global $PDOCache;
|
||||||
if (isset($PDOCache[$this->host])) {
|
if (isset($PDOCache[$this->host])) {
|
||||||
$this->PDO = $PDOCache[$this->host]['pdo'];
|
$this->PDO = $PDOCache[$this->host]['pdo'];
|
||||||
} else {
|
} else {*/
|
||||||
$dsn = "mysql:";
|
$dsn = "mysql:";
|
||||||
$dsn .= "host=" . $cfg['db'][$db]['host'] . ";";
|
$dsn .= "host=" . $cfg['db'][$db]['host'] . ";";
|
||||||
// $dsn .= "dbname=" . $cfg['db'][$db]['name'] . ";";
|
$dsn .= "dbname=" . $cfg['db'][$db]['name'] . ";"; // Comment this out when using the cache
|
||||||
$dsn .= "port=" . $cfg['db'][$db]['port'] . ";";
|
$dsn .= "port=" . $cfg['db'][$db]['port'] . ";";
|
||||||
|
|
||||||
$opt = array(
|
$opt = array(
|
||||||
|
@ -68,11 +68,11 @@ class DBLayer {
|
||||||
PDO::ATTR_PERSISTENT => true
|
PDO::ATTR_PERSISTENT => true
|
||||||
);
|
);
|
||||||
$this->PDO = new PDO($dsn, $cfg['db'][$db]['user'], $cfg['db'][$db]['pass'], $opt);
|
$this->PDO = new PDO($dsn, $cfg['db'][$db]['user'], $cfg['db'][$db]['pass'], $opt);
|
||||||
$PDOCache[$this->host] = array();
|
/* $PDOCache[$this->host] = array();
|
||||||
$PDOCache[$this->host]['pdo'] = $this->PDO;
|
$PDOCache[$this->host]['pdo'] = $this->PDO;
|
||||||
$PDOCache[$this->host]['use'] = $this->dbname;
|
$PDOCache[$this->host]['use'] = $this->dbname;
|
||||||
$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
*/ //$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
||||||
}
|
/*}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function __destruct() {
|
function __destruct() {
|
||||||
|
@ -80,11 +80,11 @@ class DBLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
function useDb() {
|
function useDb() {
|
||||||
global $PDOCache;
|
/*global $PDOCache;
|
||||||
if ($PDOCache[$this->host]['use'] != $this->dbname) {
|
if ($PDOCache[$this->host]['use'] != $this->dbname) {
|
||||||
$PDOCache[$this->host]['use'] = $this->dbname;
|
$PDOCache[$this->host]['use'] = $this->dbname;
|
||||||
$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue