1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Traffic counters tweak.

This commit is contained in:
Cameron
2019-02-10 14:51:51 -08:00
parent 535fef8799
commit 42147e2227
2 changed files with 669 additions and 622 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -51,6 +51,8 @@ class e_db_pdo implements e_db
private $pdo = true; // using PDO or not. private $pdo = true; // using PDO or not.
private $pdoBind = false; private $pdoBind = false;
private $traffic;
/** /**
* Constructor - gets language options from the cookie or session * Constructor - gets language options from the cookie or session
@@ -58,16 +60,16 @@ class e_db_pdo implements e_db
*/ */
public function __construct() public function __construct()
{ {
global $pref, $db_defaultPrefix;
/* /*
if((PHP_MAJOR_VERSION > 6) || !function_exists('mysql_connect') || (defined('e_PDO') && e_PDO === true)) if((PHP_MAJOR_VERSION > 6) || !function_exists('mysql_connect') || (defined('e_PDO') && e_PDO === true))
{ {
$this->pdo = true; $this->pdo = true;
} }
*/e107::getSingleton('e107_traffic')->BumpWho('Create db object', 1); */
$this->traffic = e107::getSingleton('e107_traffic');
$this->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
@@ -76,17 +78,7 @@ class e_db_pdo implements e_db
$this->mySQLport = intval($port); $this->mySQLport = intval($port);
} }
/*$langid = (isset($pref['cookie_name'])) ? 'e107language_'.$pref['cookie_name'] : 'e107language_temp';
if (isset($pref['user_tracking']) && ($pref['user_tracking'] == 'session'))
{
if (!isset($_SESSION[$langid])) { return; }
$this->mySQLlanguage = $_SESSION[$langid];
}
else
{
if (!isset($_COOKIE[$langid])) { return; }
$this->mySQLlanguage = $_COOKIE[$langid];
}*/
// Detect is already done in language handler, use it if not too early // Detect is already done in language handler, use it if not too early
if(defined('e_LANGUAGE')) $this->mySQLlanguage = e107::getLanguage()->e_language; if(defined('e_LANGUAGE')) $this->mySQLlanguage = e107::getLanguage()->e_language;
} }
@@ -196,7 +188,7 @@ class e_db_pdo implements e_db
{ {
global $db_ConnectionID, $db_defaultPrefix; global $db_ConnectionID, $db_defaultPrefix;
e107::getSingleton('e107_traffic')->BumpWho('db Connect', 1); $this->traffic->BumpWho('db Connect', 1);
$this->mySQLserver = $mySQLserver; $this->mySQLserver = $mySQLserver;
$this->mySQLuser = $mySQLuser; $this->mySQLuser = $mySQLuser;
@@ -441,8 +433,8 @@ class e_db_pdo implements e_db
$e = microtime(); $e = microtime();
e107::getSingleton('e107_traffic')->Bump('db_Query', $b, $e); $this->traffic->Bump('db_Query', $b, $e);
$mytime = e107::getSingleton('e107_traffic')->TimeDelta($b,$e); $mytime = $this->traffic->TimeDelta($b,$e);
$db_time += $mytime; $db_time += $mytime;
$this->mySQLresult = $sQryRes; $this->mySQLresult = $sQryRes;
@@ -1360,7 +1352,7 @@ class e_db_pdo implements e_db
/** @var PDOStatement $resource */ /** @var PDOStatement $resource */
$resource = $this->mySQLresult; $resource = $this->mySQLresult;
$row = $resource->fetch($type); $row = $resource->fetch($type);
e107::getSingleton('e107_traffic')->Bump('db_Fetch', $b); $this->traffic->Bump('db_Fetch', $b);
if ($row) if ($row)
{ {
$this->dbError('db_Fetch'); $this->dbError('db_Fetch');
@@ -1453,7 +1445,7 @@ class e_db_pdo implements e_db
function close() function close()
{ {
$this->provide_mySQLaccess(); $this->provide_mySQLaccess();
e107::getSingleton('e107_traffic')->BumpWho('db Close', 1); $this->traffic->BumpWho('db Close', 1);
$this->mySQLaccess = NULL; // correct way to do it when using shared links. $this->mySQLaccess = NULL; // correct way to do it when using shared links.
$this->dbError('dbClose'); $this->dbError('dbClose');
} }