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:
@@ -17,9 +17,15 @@
|
|||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if(!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class e107_db_debug
|
||||||
|
{
|
||||||
|
|
||||||
class e107_db_debug {
|
|
||||||
var $aSQLdetails = array(); // DB query analysis (in pieces for further analysis)
|
var $aSQLdetails = array(); // DB query analysis (in pieces for further analysis)
|
||||||
var $aDBbyTable = array();
|
var $aDBbyTable = array();
|
||||||
var $aOBMarks = array(0 => ''); // Track output buffer level at each time mark
|
var $aOBMarks = array(0 => ''); // Track output buffer level at each time mark
|
||||||
@@ -39,10 +45,11 @@ class e107_db_debug {
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function e107_db_debug() {
|
function e107_db_debug()
|
||||||
|
{
|
||||||
|
|
||||||
global $eTimingStart;
|
global $eTimingStart;
|
||||||
|
|
||||||
$this->aTimeMarks[0] = array(
|
$this->aTimeMarks[0] = array(
|
||||||
@@ -65,6 +72,7 @@ class e107_db_debug {
|
|||||||
//
|
//
|
||||||
function Show_All()
|
function Show_All()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->ShowIf('Debug Log', $this->Show_Log());
|
$this->ShowIf('Debug Log', $this->Show_Log());
|
||||||
$this->ShowIf('Traffic Counters', e107::getSingleton('e107_traffic')->Display());
|
$this->ShowIf('Traffic Counters', e107::getSingleton('e107_traffic')->Display());
|
||||||
$this->ShowIf('Time Analysis', $this->Show_Performance());
|
$this->ShowIf('Time Analysis', $this->Show_Performance());
|
||||||
@@ -93,11 +101,13 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Mark_Time($sMarker) { // Should move to traffic_class?
|
function Mark_Time($sMarker)
|
||||||
|
{ // Should move to traffic_class?
|
||||||
$timeNow = microtime();
|
$timeNow = microtime();
|
||||||
$nMarks = ++$this->nTimeMarks;
|
$nMarks = ++$this->nTimeMarks;
|
||||||
|
|
||||||
if (!strlen($sMarker)) {
|
if(!strlen($sMarker))
|
||||||
|
{
|
||||||
$sMarker = "Mark not set";
|
$sMarker = "Mark not set";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,14 +145,16 @@ class e107_db_debug {
|
|||||||
*/
|
*/
|
||||||
function Mark_Query($query, $rli, $origQryRes, $aTrace, $mytime, $curtable)
|
function Mark_Query($query, $rli, $origQryRes, $aTrace, $mytime, $curtable)
|
||||||
{
|
{
|
||||||
|
|
||||||
// global $sql;
|
// global $sql;
|
||||||
$sql = e107::getDb($rli);
|
$sql = e107::getDb($rli);
|
||||||
|
|
||||||
// Explain the query, if possible...
|
// Explain the query, if possible...
|
||||||
list($qtype, $args) = explode(" ", ltrim($query), 2);
|
list($qtype, $args) = explode(" ", ltrim($query), 2);
|
||||||
|
|
||||||
|
unset($args);
|
||||||
$nFields = 0;
|
$nFields = 0;
|
||||||
$bExplained = FALSE;
|
$bExplained = false;
|
||||||
$ExplainText = '';
|
$ExplainText = '';
|
||||||
// Note the subtle bracket in the second comparison! Also, strcasecmp() returns zero on match
|
// Note the subtle bracket in the second comparison! Also, strcasecmp() returns zero on match
|
||||||
if(!strcasecmp($qtype, 'SELECT') || !strcasecmp($qtype, '(SELECT'))
|
if(!strcasecmp($qtype, 'SELECT') || !strcasecmp($qtype, '(SELECT'))
|
||||||
@@ -156,7 +168,7 @@ class e107_db_debug {
|
|||||||
{
|
{
|
||||||
//$nFields = mysql_num_fields($sQryRes);
|
//$nFields = mysql_num_fields($sQryRes);
|
||||||
$nFields = $sql->columnCount($sQryRes); // mysql_num_fields($sQryRes);
|
$nFields = $sql->columnCount($sQryRes); // mysql_num_fields($sQryRes);
|
||||||
$bExplained = TRUE;
|
$bExplained = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -179,13 +191,13 @@ class e107_db_debug {
|
|||||||
|
|
||||||
if($bExplained)
|
if($bExplained)
|
||||||
{
|
{
|
||||||
$bRowHeaders=FALSE;
|
$bRowHeaders = false;
|
||||||
// while ($row = @mysql_fetch_assoc($sQryRes))
|
// while ($row = @mysql_fetch_assoc($sQryRes))
|
||||||
while($row = $sql->fetch())
|
while($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
if(!$bRowHeaders)
|
if(!$bRowHeaders)
|
||||||
{
|
{
|
||||||
$bRowHeaders=TRUE;
|
$bRowHeaders = true;
|
||||||
$t['explain'] = "<tr><td class='forumheader3'><b>" . implode("</b></td><td class='forumheader3'><b>", array_keys($row)) . "</b></td></tr>\n";
|
$t['explain'] = "<tr><td class='forumheader3'><b>" . implode("</b></td><td class='forumheader3'><b>", array_keys($row)) . "</b></td></tr>\n";
|
||||||
}
|
}
|
||||||
$t['explain'] .= "<tr><td class='forumheader3'>" . implode(" </td><td class='forumheader3'>", array_values($row)) . " </td></tr>\n";
|
$t['explain'] .= "<tr><td class='forumheader3'>" . implode(" </td><td class='forumheader3'>", array_values($row)) . " </td></tr>\n";
|
||||||
@@ -215,8 +227,9 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Show_SQL_Details($force = false)
|
||||||
|
{
|
||||||
|
|
||||||
function Show_SQL_Details($force=false) {
|
|
||||||
global $sql;
|
global $sql;
|
||||||
//
|
//
|
||||||
// Show stats from aSQLdetails array
|
// Show stats from aSQLdetails array
|
||||||
@@ -230,7 +243,10 @@ class e107_db_debug {
|
|||||||
$text = '';
|
$text = '';
|
||||||
$nQueries = $sql->db_QueryCount();
|
$nQueries = $sql->db_QueryCount();
|
||||||
|
|
||||||
if (!$nQueries) return $text;
|
if(!$nQueries)
|
||||||
|
{
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ALWAYS summarize query errors
|
// ALWAYS summarize query errors
|
||||||
@@ -250,12 +266,14 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($badCount) {
|
if($badCount)
|
||||||
|
{
|
||||||
$text .= "\n<table class='fborder table table-striped table-bordered'>\n";
|
$text .= "\n<table class='fborder table table-striped table-bordered'>\n";
|
||||||
$text .= "<tr><td class='fcaption' colspan='2'><b>$badCount Query Errors!</b></td></tr>\n";
|
$text .= "<tr><td class='fcaption' colspan='2'><b>$badCount Query Errors!</b></td></tr>\n";
|
||||||
$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Query / Error</b></td></tr>\n";
|
$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Query / Error</b></td></tr>\n";
|
||||||
|
|
||||||
foreach ($this->aSQLdetails as $idx => $cQuery) {
|
foreach($this->aSQLdetails as $idx => $cQuery)
|
||||||
|
{
|
||||||
if(!$cQuery['ok'])
|
if(!$cQuery['ok'])
|
||||||
{
|
{
|
||||||
$text .= "<tr><td class='forumheader3' rowspan='2' style='text-align:right'>{$idx} </td>
|
$text .= "<tr><td class='forumheader3' rowspan='2' style='text-align:right'>{$idx} </td>
|
||||||
@@ -298,7 +316,6 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "\n</table><br />\n";
|
$text .= "\n</table><br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,10 +330,12 @@ class e107_db_debug {
|
|||||||
{
|
{
|
||||||
$text .= "\n<table class='fborder table table-striped table-bordered' style='width: 100%;'>\n";
|
$text .= "\n<table class='fborder table table-striped table-bordered' style='width: 100%;'>\n";
|
||||||
$text .= "<tr><td class='forumheader3' colspan='" . $cQuery['nFields'] . "'><b>" . $idx . ") Query:</b> [" . $cQuery['marker'] . " - " . $cQuery['caller'] . "]<br />" . $cQuery['query'] . "</td></tr>\n";
|
$text .= "<tr><td class='forumheader3' colspan='" . $cQuery['nFields'] . "'><b>" . $idx . ") Query:</b> [" . $cQuery['marker'] . " - " . $cQuery['caller'] . "]<br />" . $cQuery['query'] . "</td></tr>\n";
|
||||||
if (isset($cQuery['explain'])) {
|
if(isset($cQuery['explain']))
|
||||||
|
{
|
||||||
$text .= $cQuery['explain'];
|
$text .= $cQuery['explain'];
|
||||||
}
|
}
|
||||||
if (strlen($cQuery['error'])) {
|
if(strlen($cQuery['error']))
|
||||||
|
{
|
||||||
$text .= "<tr><td class='forumheader3' ><b>Error in query:</b></td></tr>\n<tr><td class='forumheader3'>" . $cQuery['error'] . "</td></tr>\n";
|
$text .= "<tr><td class='forumheader3' ><b>Error in query:</b></td></tr>\n<tr><td class='forumheader3'>" . $cQuery['error'] . "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,6 +359,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function countLabel($amount)
|
function countLabel($amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($amount < 30)
|
if($amount < 30)
|
||||||
{
|
{
|
||||||
$inc = 'label-success';
|
$inc = 'label-success';
|
||||||
@@ -359,6 +379,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function save($log)
|
function save($log)
|
||||||
{
|
{
|
||||||
|
|
||||||
e107::getMessage()->addDebug("Saving a log");
|
e107::getMessage()->addDebug("Saving a log");
|
||||||
|
|
||||||
$titles = array_keys($this->aTimeMarks[0]);
|
$titles = array_keys($this->aTimeMarks[0]);
|
||||||
@@ -391,6 +412,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function Show_Performance()
|
function Show_Performance()
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stats by Time Marker
|
// Stats by Time Marker
|
||||||
//
|
//
|
||||||
@@ -436,7 +458,6 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(list($tKey, $tMarker) = each($this->aTimeMarks))
|
while(list($tKey, $tMarker) = each($this->aTimeMarks))
|
||||||
{
|
{
|
||||||
if(!$bRowHeaders)
|
if(!$bRowHeaders)
|
||||||
@@ -465,7 +486,6 @@ class e107_db_debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $tMem = ($tMarker['Memory'] - $aSum['Memory']);
|
// $tMem = ($tMarker['Memory'] - $aSum['Memory']);
|
||||||
|
|
||||||
$tMem = ($tMarker['Memory']);
|
$tMem = ($tMarker['Memory']);
|
||||||
@@ -628,7 +648,8 @@ class e107_db_debug {
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function logDeprecated(){
|
function logDeprecated()
|
||||||
|
{
|
||||||
|
|
||||||
$back_trace = debug_backtrace();
|
$back_trace = debug_backtrace();
|
||||||
|
|
||||||
@@ -644,9 +665,10 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function logCode($type, $code, $parm, $details)
|
function logCode($type, $code, $parm, $details)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!E107_DBG_BBSC)
|
if(!E107_DBG_BBSC)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->scbbcodes[$this->scbcount]['type'] = $type;
|
$this->scbbcodes[$this->scbcount]['type'] = $type;
|
||||||
@@ -654,10 +676,13 @@ class e107_db_debug {
|
|||||||
$this->scbbcodes[$this->scbcount]['parm'] = (string) $parm;
|
$this->scbbcodes[$this->scbcount]['parm'] = (string) $parm;
|
||||||
$this->scbbcodes[$this->scbcount]['details'] = $details;
|
$this->scbbcodes[$this->scbcount]['details'] = $details;
|
||||||
$this->scbcount++;
|
$this->scbcount++;
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Show_SC_BB($force = false)
|
function Show_SC_BB($force = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!E107_DBG_BBSC && ($force === false))
|
if(!E107_DBG_BBSC && ($force === false))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -691,14 +716,16 @@ class e107_db_debug {
|
|||||||
</tr>\n";
|
</tr>\n";
|
||||||
}
|
}
|
||||||
$text .= "</tbody></table>";
|
$text .= "</tbody></table>";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Show_PATH($force = false)
|
function Show_PATH($force = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!E107_DBG_PATH && ($force === false))
|
if(!E107_DBG_PATH && ($force === false))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $e107;
|
global $e107;
|
||||||
@@ -752,7 +779,7 @@ class e107_db_debug {
|
|||||||
{
|
{
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3' colspan='2'><pre>".htmlspecialchars(print_r($e107,TRUE))."</pre></td>
|
<td class='forumheader3' colspan='2'><pre>" . htmlspecialchars(print_r($e107, true)) . "</pre></td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,7 +803,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='forumheader3' colspan='2'><pre>".htmlspecialchars(print_r($_SESSION,TRUE))."</pre></td>
|
<td class='forumheader3' colspan='2'><pre>" . htmlspecialchars(print_r($_SESSION, true)) . "</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -788,6 +815,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function Show_DEPRECATED($force = false)
|
function Show_DEPRECATED($force = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!E107_DBG_DEPRECATED && ($force === false))
|
if(!E107_DBG_DEPRECATED && ($force === false))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -814,6 +842,7 @@ class e107_db_debug {
|
|||||||
</tr>\n";
|
</tr>\n";
|
||||||
}
|
}
|
||||||
$text .= "</tbody></table>";
|
$text .= "</tbody></table>";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -821,10 +850,12 @@ class e107_db_debug {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* var_dump to debug log
|
* var_dump to debug log
|
||||||
|
*
|
||||||
* @param mixed $message
|
* @param mixed $message
|
||||||
*/
|
*/
|
||||||
function dump($message, $TraceLev = 1)
|
function dump($message, $TraceLev = 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
var_dump($message);
|
var_dump($message);
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
@@ -842,16 +873,19 @@ class e107_db_debug {
|
|||||||
// $this->aLog[] = array ('Message' => $content, 'Function' => '', 'File' => '', 'Line' => '' );
|
// $this->aLog[] = array ('Message' => $content, 'Function' => '', 'File' => '', 'Line' => '' );
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// Simple debug-level 'console' log
|
|
||||||
// Record a "nice" debug message with
|
/**
|
||||||
// $db_debug->log("message");
|
* @desc Simple debug-level 'console' log
|
||||||
//
|
* Record a "nice" debug message with
|
||||||
function log($message,$TraceLev=1)
|
* $db_debug->log("message");
|
||||||
|
* @param string $message
|
||||||
|
* @param int $TraceLev
|
||||||
|
* @return bool true on success , false on error
|
||||||
|
*/
|
||||||
|
public function log($message, $TraceLev = 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(is_array($message) || is_object($message))
|
if(is_array($message) || is_object($message))
|
||||||
{
|
{
|
||||||
$message = "<pre>" . print_r($message, true) . "</pre>";
|
$message = "<pre>" . print_r($message, true) . "</pre>";
|
||||||
@@ -871,7 +905,9 @@ class e107_db_debug {
|
|||||||
'File' => varset($bt[$TraceLev]['file']),
|
'File' => varset($bt[$TraceLev]['file']),
|
||||||
'Line' => varset($bt[$TraceLev]['line'])
|
'Line' => varset($bt[$TraceLev]['line'])
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->aLog[] = array(
|
$this->aLog[] = array(
|
||||||
'Message' => $message,
|
'Message' => $message,
|
||||||
'Function' => '',
|
'Function' => '',
|
||||||
@@ -879,13 +915,19 @@ class e107_db_debug {
|
|||||||
'Line' => ''
|
'Line' => ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
function Show_Log()
|
function Show_Log()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(empty($this->aLog))
|
if(empty($this->aLog))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Dump the debug log
|
// Dump the debug log
|
||||||
@@ -893,7 +935,7 @@ class e107_db_debug {
|
|||||||
|
|
||||||
$text = "\n<table class='fborder table table-striped'>\n";
|
$text = "\n<table class='fborder table table-striped'>\n";
|
||||||
|
|
||||||
$bRowHeaders=FALSE;
|
$bRowHeaders = false;
|
||||||
|
|
||||||
foreach($this->aLog as $curLog)
|
foreach($this->aLog as $curLog)
|
||||||
{
|
{
|
||||||
@@ -913,8 +955,11 @@ class e107_db_debug {
|
|||||||
|
|
||||||
function Show_Includes($force = false)
|
function Show_Includes($force = false)
|
||||||
{
|
{
|
||||||
if (!E107_DBG_INCLUDES && ($force === false)) return false;
|
|
||||||
|
|
||||||
|
if(!E107_DBG_INCLUDES && ($force === false))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$text = "<table class='fborder table table-striped'>\n";
|
$text = "<table class='fborder table table-striped'>\n";
|
||||||
@@ -922,15 +967,18 @@ class e107_db_debug {
|
|||||||
implode(" </td></tr>\n<tr><td class='forumheader3'>", $this->aIncList) .
|
implode(" </td></tr>\n<tr><td class='forumheader3'>", $this->aIncList) .
|
||||||
" </td></tr>\n";
|
" </td></tr>\n";
|
||||||
$text .= "</table>\n";
|
$text .= "</table>\n";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helper functions (not part of the class)
|
// Helper functions (not part of the class)
|
||||||
//
|
//
|
||||||
function e107_debug_shutdown()
|
function e107_debug_shutdown()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(e_AJAX_REQUEST) // extra output will break json ajax returns ie. comments
|
if(e_AJAX_REQUEST) // extra output will break json ajax returns ie. comments
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -938,7 +986,10 @@ function e107_debug_shutdown()
|
|||||||
|
|
||||||
|
|
||||||
global $error_handler, $e107_Clean_Exit, $In_e107_Footer, $ADMIN_DIRECTORY;
|
global $error_handler, $e107_Clean_Exit, $In_e107_Footer, $ADMIN_DIRECTORY;
|
||||||
if (isset($e107_Clean_Exit)) return;
|
if(isset($e107_Clean_Exit))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($In_e107_Footer))
|
if(!isset($In_e107_Footer))
|
||||||
{
|
{
|
||||||
@@ -946,7 +997,8 @@ function e107_debug_shutdown()
|
|||||||
{
|
{
|
||||||
$filewanted = realpath(dirname(__FILE__)) . '/../' . $ADMIN_DIRECTORY . 'footer.php';
|
$filewanted = realpath(dirname(__FILE__)) . '/../' . $ADMIN_DIRECTORY . 'footer.php';
|
||||||
require_once($filewanted);
|
require_once($filewanted);
|
||||||
} else if (defset('USER_AREA'))
|
}
|
||||||
|
elseif(defset('USER_AREA'))
|
||||||
{
|
{
|
||||||
$filewanted = realpath(dirname(__FILE__)) . '/../' . FOOTERF;
|
$filewanted = realpath(dirname(__FILE__)) . '/../' . FOOTERF;
|
||||||
require_once($filewanted);
|
require_once($filewanted);
|
||||||
@@ -955,11 +1007,15 @@ function e107_debug_shutdown()
|
|||||||
//
|
//
|
||||||
// Error while in the footer, or during startup, or during above processing
|
// Error while in the footer, or during startup, or during above processing
|
||||||
//
|
//
|
||||||
if (isset($e107_Clean_Exit)) return; // We've now sent a footer...
|
if(isset($e107_Clean_Exit))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
} // We've now sent a footer...
|
||||||
|
|
||||||
// echo isset($In_e107_Footer) ? "In footer" : "In startup".'<br />';
|
// echo isset($In_e107_Footer) ? "In footer" : "In startup".'<br />';
|
||||||
|
|
||||||
while (ob_get_level() > 0) {
|
while(ob_get_level() > 0)
|
||||||
|
{
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -979,4 +1035,3 @@ function e107_debug_shutdown()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@@ -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');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user