From 44b8223a5f5dc82230ca3f48cde69049ddb14055 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 3 Sep 2014 05:47:47 +0200 Subject: [PATCH] Disable connection cache workaround --- code/web/private_php/ams/autoload/dblayer.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/code/web/private_php/ams/autoload/dblayer.php b/code/web/private_php/ams/autoload/dblayer.php index 91d260fc3..3615b5729 100644 --- a/code/web/private_php/ams/autoload/dblayer.php +++ b/code/web/private_php/ams/autoload/dblayer.php @@ -29,13 +29,13 @@ * */ -$PDOCache = array(); +// $PDOCache = array(); class DBLayer { private $PDO; - private $host; - private $dbname; + // private $host; + // private $dbname; /** * The PDO object, instantiated by the constructor @@ -51,15 +51,15 @@ class DBLayer { function __construct($db, $dbn = null) { global $cfg; - $this->host = $cfg['db'][$db]['host']; - $this->dbname = $cfg['db'][$db]['name']; - global $PDOCache; + // $this->host = $cfg['db'][$db]['host']; + // $this->dbname = $cfg['db'][$db]['name']; + /*global $PDOCache; if (isset($PDOCache[$this->host])) { $this->PDO = $PDOCache[$this->host]['pdo']; - } else { + } else {*/ $dsn = "mysql:"; $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'] . ";"; $opt = array( @@ -68,11 +68,11 @@ class DBLayer { PDO::ATTR_PERSISTENT => true ); $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]['use'] = $this->dbname; - $this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety - } + */ //$this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety + /*}*/ } function __destruct() { @@ -80,11 +80,11 @@ class DBLayer { } function useDb() { - global $PDOCache; + /*global $PDOCache; if ($PDOCache[$this->host]['use'] != $this->dbname) { $PDOCache[$this->host]['use'] = $this->dbname; $this->PDO->query('USE ' . $this->dbname . ';'); // FIXME safety - } + }*/ } /**