mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 04:38:27 +01:00
another global variable killed - get rid of $eTraffic
This commit is contained in:
parent
ba1b97204b
commit
a1f98a1477
@ -9,8 +9,8 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.141 $
|
||||
* $Date: 2009-09-12 16:42:44 $
|
||||
* $Revision: 1.142 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
@ -297,8 +297,8 @@ if (!$ADMIN_DIRECTORY && !$DOWNLOADS_DIRECTORY)
|
||||
//
|
||||
// J: MYSQL INITIALIZATION
|
||||
//
|
||||
$eTraffic = e107::getSingleton('e107_traffic', e_HANDLER.'traffic_class.php');
|
||||
$eTraffic->Calibrate($eTraffic); // We start traffic counting ASAP
|
||||
e107::getSingleton('e107_traffic'); // We start traffic counting ASAP
|
||||
//$eTraffic->Calibrate($eTraffic);
|
||||
|
||||
define("MPREFIX", $mySQLprefix);
|
||||
|
||||
|
@ -11,15 +11,15 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2009-08-19 14:39:56 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2009-09-13 10:29:56 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
$In_e107_Footer = TRUE; // For registered shutdown function
|
||||
|
||||
global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $ADMIN_FOOTER, $e107, $pref;
|
||||
global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $ADMIN_FOOTER, $e107, $pref;
|
||||
|
||||
//
|
||||
// SHUTDOWN SEQUENCE
|
||||
@ -54,9 +54,7 @@ if(!is_object($sql)){
|
||||
*/
|
||||
|
||||
$sql = e107::getDb();
|
||||
|
||||
$eTraffic = e107::getSingleton('e107_traffic', e_HANDLER.'traffic_class.php');
|
||||
$eTraffic->Bump('Lost Traffic Counters');
|
||||
e107::getSingleton('e107_traffic')->Bump('Lost Traffic Counters');
|
||||
|
||||
|
||||
if(varset($e107_popup)!=1){
|
||||
@ -92,7 +90,7 @@ if (ADMIN == TRUE) {
|
||||
|
||||
$eTimingStop = microtime();
|
||||
global $eTimingStart;
|
||||
$clockTime = $eTraffic->TimeDelta( $eTimingStart, $eTimingStop );
|
||||
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
|
||||
$dbPercent = 100.0 * $db_time / $clockTime;
|
||||
// Format for display or logging
|
||||
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
||||
|
@ -1,21 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/cache_handler.php,v $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2009-08-03 18:21:46 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Cache handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/cache_handler.php,v $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -23,12 +19,13 @@ if (!defined('e107_INIT')) { exit; }
|
||||
define('CACHE_PREFIX','<?php exit;');
|
||||
|
||||
/**
|
||||
* Class to cache data as files, improving site speed and throughput.
|
||||
*
|
||||
* @package e107
|
||||
* @version $Revision: 1.12 $
|
||||
* @author $Author: secretr $
|
||||
*/
|
||||
* Class to cache data as files, improving site speed and throughput.
|
||||
*
|
||||
* @package e107
|
||||
* @category e107_handlers
|
||||
* @version $Revision: 1.13 $
|
||||
* @author $Author: secretr $
|
||||
*/
|
||||
class ecache {
|
||||
|
||||
var $CachePageMD5;
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/db_debug_class.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2009-09-04 14:35:01 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2009-09-13 10:29:56 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -57,10 +57,8 @@ class e107_db_debug {
|
||||
//
|
||||
function Show_All()
|
||||
{
|
||||
global $eTraffic;
|
||||
|
||||
$this->ShowIf('Debug Log', $this->Show_Log());
|
||||
$this->ShowIf('Traffic Counters', $eTraffic->Display());
|
||||
$this->ShowIf('Traffic Counters', e107::getSingleton('e107_traffic')->Display());
|
||||
$this->ShowIf('Time Analysis', $this->Show_Performance());
|
||||
$this->ShowIf('SQL Analysis', $this->Show_SQL_Details());
|
||||
$this->ShowIf('Shortcodes / BBCode',$this->Show_SC_BB());
|
||||
@ -279,13 +277,13 @@ class e107_db_debug {
|
||||
//
|
||||
global $db_time;
|
||||
global $sql;
|
||||
global $eTimingStart, $eTimingStop, $eTraffic;
|
||||
global $eTimingStart, $eTimingStop;
|
||||
|
||||
$this->Mark_Time('Stop');
|
||||
|
||||
if (!E107_DBG_TIMEDETAILS) return '';
|
||||
|
||||
$totTime=$eTraffic->TimeDelta($eTimingStart, $eTimingStop);
|
||||
$totTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
|
||||
$text = "\n<table class='fborder'>\n";
|
||||
$bRowHeaders=FALSE;
|
||||
reset($this->aTimeMarks);
|
||||
@ -335,7 +333,7 @@ class e107_db_debug {
|
||||
$aNextT=$nextMarker['Time'];
|
||||
$aThisT=$tMarker['Time'];
|
||||
|
||||
$thisDelta=$eTraffic->TimeDelta($aThisT, $aNextT);
|
||||
$thisDelta = e107::getSingleton('e107_traffic')->TimeDelta($aThisT, $aNextT);
|
||||
$aSum['Time'] += $thisDelta;
|
||||
$aSum['DB Time'] += $tMarker['DB Time'];
|
||||
$aSum['DB Count'] += $tMarker['DB Count'];
|
||||
|
@ -9,19 +9,13 @@
|
||||
* mySQL Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||
* $Revision: 1.51 $
|
||||
* $Date: 2009-09-10 19:13:39 $
|
||||
* $Revision: 1.52 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if(defined('MYSQL_LIGHT'))
|
||||
{
|
||||
class dummyTraffic {
|
||||
function Bump() { return; }
|
||||
function BumpWho() { return; }
|
||||
function TimeDelta() { return; }
|
||||
}
|
||||
$eTraffic = new dummyTraffic;
|
||||
define('E107_DEBUG_LEVEL', 0);
|
||||
define('e_QUERY', '');
|
||||
$path = (MYSQL_LIGHT !== true ? MYSQL_LIGHT : '');
|
||||
@ -32,14 +26,6 @@ if(defined('MYSQL_LIGHT'))
|
||||
}
|
||||
elseif(defined('E107_INSTALL')) //TODO Remove the need for this if possible
|
||||
{
|
||||
class dummyTraffic {
|
||||
function Bump() { return; }
|
||||
function BumpWho($val,$val) { return; }
|
||||
function TimeDelta() { return; }
|
||||
}
|
||||
|
||||
global $eTraffic;
|
||||
$eTraffic = new dummyTraffic;
|
||||
define('E107_DEBUG_LEVEL', 0);
|
||||
define('e_QUERY', '');
|
||||
require_once("e107_config.php");
|
||||
@ -63,7 +49,7 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
|
||||
*
|
||||
* @package e107
|
||||
* @category e107_handlers
|
||||
* @version $Revision: 1.51 $
|
||||
* @version $Revision: 1.52 $
|
||||
* @author $Author: secretr $
|
||||
*
|
||||
*/
|
||||
@ -103,8 +89,8 @@ class e_db_mysql {
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
global $pref, $eTraffic, $db_defaultPrefix;
|
||||
$eTraffic->BumpWho('Create db object', 1);
|
||||
global $pref, $db_defaultPrefix;
|
||||
e107::getSingleton('e107_traffic')->BumpWho('Create db object', 1);
|
||||
|
||||
$this->mySQLPrefix = MPREFIX; // Set the default prefix - may be overridden
|
||||
$langid = 'e107language_'.$pref['cookie_name'];
|
||||
@ -141,8 +127,8 @@ class e_db_mysql {
|
||||
*/
|
||||
public function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $newLink = FALSE, $mySQLPrefix = MPREFIX)
|
||||
{
|
||||
global $eTraffic, $db_ConnectionID, $db_defaultPrefix;
|
||||
$eTraffic->BumpWho('db Connect', 1);
|
||||
global $db_ConnectionID, $db_defaultPrefix;
|
||||
e107::getSingleton('e107_traffic')->BumpWho('db Connect', 1);
|
||||
|
||||
$this->mySQLserver = $mySQLserver;
|
||||
$this->mySQLuser = $mySQLuser;
|
||||
@ -240,7 +226,7 @@ class e_db_mysql {
|
||||
*/
|
||||
public function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '')
|
||||
{
|
||||
global $db_time,$db_mySQLQueryCount,$queryinfo, $eTraffic;
|
||||
global $db_time,$db_mySQLQueryCount,$queryinfo;
|
||||
$db_mySQLQueryCount++;
|
||||
|
||||
if ($debug == 'now')
|
||||
@ -266,8 +252,8 @@ class e_db_mysql {
|
||||
$sQryRes = is_null($rli) ? @mysql_query($query,$this->mySQLaccess) : @mysql_query($query, $rli);
|
||||
$e = microtime();
|
||||
|
||||
$eTraffic->Bump('db_Query', $b, $e);
|
||||
$mytime = $eTraffic->TimeDelta($b,$e);
|
||||
e107::getSingleton('e107_traffic')->Bump('db_Query', $b, $e);
|
||||
$mytime = e107::getSingleton('e107_traffic')->TimeDelta($b,$e);
|
||||
$db_time += $mytime;
|
||||
$this->mySQLresult = $sQryRes;
|
||||
|
||||
@ -658,14 +644,13 @@ class e_db_mysql {
|
||||
*/
|
||||
function db_Fetch($type = MYSQL_ASSOC)
|
||||
{
|
||||
global $eTraffic;
|
||||
if (!(is_int($type)))
|
||||
{
|
||||
$type=MYSQL_ASSOC;
|
||||
}
|
||||
$b = microtime();
|
||||
$row = @mysql_fetch_array($this->mySQLresult,$type);
|
||||
$eTraffic->Bump('db_Fetch', $b);
|
||||
e107::getSingleton('e107_traffic')->Bump('db_Fetch', $b);
|
||||
if ($row)
|
||||
{
|
||||
$this->dbError('db_Fetch');
|
||||
@ -740,13 +725,12 @@ class e_db_mysql {
|
||||
*/
|
||||
function db_Close()
|
||||
{
|
||||
global $eTraffic;
|
||||
if(!$this->mySQLaccess)
|
||||
{
|
||||
global $db_ConnectionID;
|
||||
$this->mySQLaccess = $db_ConnectionID;
|
||||
}
|
||||
$eTraffic->BumpWho('db Close', 1);
|
||||
e107::getSingleton('e107_traffic')->BumpWho('db Close', 1);
|
||||
$this->mySQLaccess = NULL; // correct way to do it when using shared links.
|
||||
$this->dbError('dbClose');
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
* News handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 2009-09-12 18:25:41 $
|
||||
* $Revision: 1.21 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@ -432,7 +432,7 @@ class news {
|
||||
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
|
||||
|
||||
$datarw = array();
|
||||
$datarw['data']['news_rewrite_id'] = intval($news['news_rewrite_id']);
|
||||
$datarw['data']['news_rewrite_id'] = $news['news_rewrite_id'];
|
||||
$datarw['_FIELD_TYPES']['news_rewrite_id'] = 'int';
|
||||
$datarw['data']['news_rewrite_string'] = trim($news['news_rewrite_string']);
|
||||
$datarw['_FIELD_TYPES']['news_rewrite_string'] = 'todb';
|
||||
|
@ -1,159 +1,192 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <EFBFBD>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/traffic_class.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-09-04 14:35:01 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Traffic handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/traffic_class.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class e107_traffic {
|
||||
var $aTraffic=array(); // Overall system traffic counters
|
||||
var $aTrafficTimed=array(); // Timed traffic counters
|
||||
var $aTrafficWho=array(); // Overall system traffic source tracking
|
||||
var $calPassBoth=0.0; // Calibration offset when both parameters are passed
|
||||
var $calPassOne=0.0; // Calibration offset when only one parameter is passed
|
||||
var $calTime=0.0; // Total time spent in overhead, based on calibration
|
||||
var $qTimeOn=0; // Quick Timer: when it started
|
||||
var $qTimeTotal=0.0; // Quick Timer: Accumulated time
|
||||
|
||||
// function e107_traffic() {
|
||||
// No dynamic initializers needed, so no constructor
|
||||
// }
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class e107_traffic
|
||||
{
|
||||
var $aTraffic = array(); // Overall system traffic counters
|
||||
var $aTrafficTimed = array(); // Timed traffic counters
|
||||
var $aTrafficWho = array(); // Overall system traffic source tracking
|
||||
var $calPassBoth = 0.0; // Calibration offset when both parameters are passed
|
||||
var $calPassOne = 0.0; // Calibration offset when only one parameter is passed
|
||||
var $calTime = 0.0; // Total time spent in overhead, based on calibration
|
||||
var $qTimeOn = 0; // Quick Timer: when it started
|
||||
var $qTimeTotal = 0.0; // Quick Timer: Accumulated time
|
||||
|
||||
/**
|
||||
* @return float Time difference
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Calculate time difference between to microtimes
|
||||
* @access public
|
||||
*/
|
||||
function TimeDelta($tStart, $tFinish ) {
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct($calibrate = true)
|
||||
{
|
||||
//auto calibrate
|
||||
if($calibrate)
|
||||
{
|
||||
$this->Calibrate($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float Time difference
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Calculate time difference between to microtimes
|
||||
* @access public
|
||||
*/
|
||||
function TimeDelta($tStart, $tFinish)
|
||||
{
|
||||
$tFrom = explode(' ', $tStart);
|
||||
$tTo = explode(' ', $tFinish);
|
||||
$tTot = ((float)$tTo[0] + (float)$tTo[1]) - ((float)$tFrom[0] + (float)$tFrom[1]);
|
||||
$tTot = ((float) $tTo[0] + (float) $tTo[1]) - ((float) $tFrom[0] + (float) $tFrom[1]);
|
||||
return $tTot;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return float Absolute time from microtime
|
||||
* @param time $tStart time - unexploded microtime result
|
||||
* @desc Return absolute time
|
||||
* @access public
|
||||
*/
|
||||
function TimeAbs($tStart ) {
|
||||
* @return float Absolute time from microtime
|
||||
* @param time $tStart time - unexploded microtime result
|
||||
* @desc Return absolute time
|
||||
* @access public
|
||||
*/
|
||||
function TimeAbs($tStart)
|
||||
{
|
||||
$tFrom = explode(' ', $tStart);
|
||||
return (float)$tFrom[0] + (float)$tFrom[1];
|
||||
return (float) $tFrom[0] + (float) $tFrom[1];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @param string $sWhat what to count
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Count one of anything, optionally with time used
|
||||
* @access public
|
||||
*/
|
||||
function Bump($sWhat, $tStart = 0, $tFinish = 0) {
|
||||
* @return void
|
||||
* @param string $sWhat what to count
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Count one of anything, optionally with time used
|
||||
* @access public
|
||||
*/
|
||||
function Bump($sWhat, $tStart = 0, $tFinish = 0)
|
||||
{
|
||||
$x = microtime(); // on my system:
|
||||
// 0 err: $e=microtime(); $eTraffic->Bump('foo',$b,$e);
|
||||
// ~15 usec err: $eTraffic->Bump('foo',$b,microtime());
|
||||
// ~25 usec err: $eTraffic->Bump('foo',$b);
|
||||
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
|
||||
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($tStart) {
|
||||
|
||||
if ($tStart)
|
||||
{
|
||||
$vName = 'aTrafficTimed';
|
||||
$bTimed = TRUE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$vName = 'aTraffic';
|
||||
$bTimed = FALSE;
|
||||
}
|
||||
if (!isset($this->{$vName}[$sWhat])) {
|
||||
$this->{$vName}[$sWhat] = array();
|
||||
$t = & $this->{$vName}[$sWhat];
|
||||
if (!isset($this-> {$vName} [$sWhat]))
|
||||
{
|
||||
$this-> {$vName} [$sWhat] = array();
|
||||
$t = &$this-> {$vName} [$sWhat];
|
||||
$t['Count'] = 0;
|
||||
if ($bTimed) {
|
||||
if ($bTimed)
|
||||
{
|
||||
$t['Time'] = 0.0;
|
||||
$t['Min'] = 999999999.0;
|
||||
$t['Max'] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
$this->{$vName}[$sWhat]['Count']++;
|
||||
|
||||
if ($bTimed) {
|
||||
$t = & $this->aTrafficTimed[$sWhat];
|
||||
if (!$tFinish) {
|
||||
|
||||
$this-> {$vName} [$sWhat]['Count']++;
|
||||
|
||||
if ($bTimed)
|
||||
{
|
||||
$t = &$this->aTrafficTimed[$sWhat];
|
||||
if (!$tFinish)
|
||||
{
|
||||
$tFinish = $x;
|
||||
$offset = $this->calPassOne;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$offset = $this->calPassBoth;
|
||||
}
|
||||
$time = $this->TimeDelta($tStart, $tFinish ) - $offset;
|
||||
$time = $this->TimeDelta($tStart, $tFinish) - $offset;
|
||||
$this->calTime += $offset;
|
||||
$t['Time'] += $time;
|
||||
if ($time < $t['Min']) $t['Min'] = $time;
|
||||
if ($time > $t['Max']) $t['Max'] = $time;
|
||||
if ($time < $t['Min'])
|
||||
$t['Min'] = $time;
|
||||
if ($time > $t['Max'])
|
||||
$t['Max'] = $time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @param string $sWhat what to count
|
||||
* @param int $level who to record: default caller. 1-999=N levels up the call tree
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Count one of anything, optionally with time used.
|
||||
* @access public
|
||||
*/
|
||||
function BumpWho($sWhat, $level = 0, $tStart = 0, $tFinish = 0) {
|
||||
* @return void
|
||||
* @param string $sWhat what to count
|
||||
* @param int $level who to record: default caller. 1-999=N levels up the call tree
|
||||
* @param time $tStart Start time - unexploded microtime result
|
||||
* @param time $tStop Finish time - unexploded microtime result
|
||||
* @desc Count one of anything, optionally with time used.
|
||||
* @access public
|
||||
*/
|
||||
function BumpWho($sWhat, $level = 0, $tStart = 0, $tFinish = 0)
|
||||
{
|
||||
$x = microtime();
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->Bump($sWhat, $tStart, ($tFinish? $tFinish : $x));
|
||||
|
||||
if (!isset($this->aTrafficWho[$sWhat])) {
|
||||
|
||||
$this->Bump($sWhat, $tStart, ($tFinish ? $tFinish : $x));
|
||||
|
||||
if (!isset($this->aTrafficWho[$sWhat]))
|
||||
{
|
||||
$this->aTrafficWho[$sWhat] = array();
|
||||
}
|
||||
$aTrace = debug_backtrace();
|
||||
if ($level >= count($aTrace)) {
|
||||
$level = count($aTrace)-1;
|
||||
if ($level >= count($aTrace))
|
||||
{
|
||||
$level = count($aTrace) - 1;
|
||||
}
|
||||
$sFile = $aTrace[$level]['file'];
|
||||
$sLine = $aTrace[$level]['line'];
|
||||
|
||||
|
||||
$this->aTrafficWho[$sWhat][] = "$sFile($sLine)";
|
||||
}
|
||||
|
||||
function Calibrate($tObject, $count = 10 ) {
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
|
||||
|
||||
function Calibrate($tObject, $count = 10)
|
||||
{
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ($tObject != $this) {
|
||||
message_handler("CRITICAL_ERROR", "Bad traffic object", __LINE__-2, __FILE__);
|
||||
if ($tObject != $this)
|
||||
{
|
||||
message_handler("CRITICAL_ERROR", "Bad traffic object", __LINE__ - 2, __FILE__);
|
||||
}
|
||||
if ($count <= 0) return; // no calibration
|
||||
|
||||
if ($count <= 0)
|
||||
return; // no calibration
|
||||
|
||||
$this->calPassBoth = $this->calPassOne = 0.0;
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$b = microtime();
|
||||
$e = microtime();
|
||||
$tObject->Bump('TRAF_CAL1', $b, $e); // emulate the normal non-insider call
|
||||
@ -161,52 +194,54 @@ class e107_traffic {
|
||||
$tObject->Bump('TRAF_CAL2', $b);
|
||||
}
|
||||
$t = $tObject->aTrafficTimed['TRAF_CAL1'];
|
||||
$this->calPassBoth = $t['Time']/$t['Count'];
|
||||
$this->calPassBoth = $t['Time'] / $t['Count'];
|
||||
$t = $tObject->aTrafficTimed['TRAF_CAL2'];
|
||||
$this->calPassOne = $t['Time']/$t['Count'];
|
||||
$this->calPassOne = $t['Time'] / $t['Count'];
|
||||
}
|
||||
|
||||
function Display() {
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC || E107_DBG_BASIC) // 'Basic' should not display Traffic.
|
||||
{
|
||||
|
||||
function Display()
|
||||
{
|
||||
if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC || E107_DBG_BASIC) // 'Basic' should not display Traffic.
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$text = '';
|
||||
@include_once(e_HANDLER.'traffic_class_display.php');
|
||||
return $text;
|
||||
@ include_once (e_HANDLER.'traffic_class_display.php');
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This is a set of quick-n-simple tools to measure ONE bit of render time,
|
||||
// without any need for debug to be working. You can copy to somewhere else if needed
|
||||
// such as before this class has been loaded
|
||||
|
||||
if (!isset($qTimeOn)) {
|
||||
$qTimeOn=0;
|
||||
$qTimeTotal=0;
|
||||
function eQTimeOn() {
|
||||
$GLOBALS['qTimeOn']=explode(' ',microtime());
|
||||
if (!isset($qTimeOn))
|
||||
{
|
||||
$qTimeOn = 0;
|
||||
$qTimeTotal = 0;
|
||||
function eQTimeOn()
|
||||
{
|
||||
$GLOBALS['qTimeOn'] = explode(' ', microtime());
|
||||
}
|
||||
function eQTimeOff() {
|
||||
$e=explode(' ',microtime());
|
||||
$diff=((float)$e[0] + (float)$e[1]) - ((float)$qTimeOn[0] + (float)$qTimeOn[1]);
|
||||
function eQTimeOff()
|
||||
{
|
||||
$e = explode(' ', microtime());
|
||||
$diff = ((float) $e[0] + (float) $e[1]) - ((float) $qTimeOn[0] + (float) $qTimeOn[1]);
|
||||
$GLOBALS['qTimeTotal'] += $diff;
|
||||
}
|
||||
function eQTimeElapsed() {
|
||||
function eQTimeElapsed()
|
||||
{
|
||||
// return elapsed time so far, as text in microseconds, or blank if zero
|
||||
if (isset($GLOBALS['qTimeTotal']))
|
||||
{
|
||||
return number_format($GLOBALS['qTimeTotal']*1000000.0,1);
|
||||
}
|
||||
return number_format($GLOBALS['qTimeTotal'] * 1000000.0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -11,15 +11,15 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
|
||||
| $Revision: 1.16 $
|
||||
| $Date: 2009-09-06 20:04:04 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.17 $
|
||||
| $Date: 2009-09-13 10:29:56 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
$In_e107_Footer = TRUE; // For registered shutdown function
|
||||
|
||||
global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $FOOTER, $e107;
|
||||
global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $FOOTER, $e107;
|
||||
|
||||
//
|
||||
// SHUTDOWN SEQUENCE
|
||||
@ -41,22 +41,7 @@ global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $myS
|
||||
// H Final HTML (/body, /html)
|
||||
// I collect and send buffered page, along with needed headers
|
||||
//
|
||||
|
||||
//
|
||||
// A Ensure sql and traffic objects exist
|
||||
//
|
||||
|
||||
if(!is_object($sql))
|
||||
{
|
||||
// reinstigate db connection if another connection from third-party script closed it ...
|
||||
$sql = new db;
|
||||
$sql -> db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
||||
}
|
||||
if (!is_object($eTraffic))
|
||||
{
|
||||
$eTraffic = new e107_traffic;
|
||||
$eTraffic->Bump('Lost Traffic Counters');
|
||||
}
|
||||
$sql = e107::getDb();
|
||||
|
||||
if(varset($e107_popup)!=1)
|
||||
{
|
||||
@ -71,7 +56,7 @@ if(varset($e107_popup)!=1)
|
||||
|
||||
$eTimingStop = microtime();
|
||||
global $eTimingStart;
|
||||
$clockTime = $eTraffic->TimeDelta( $eTimingStart, $eTimingStop );
|
||||
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
|
||||
$dbPercent = 100.0 * $db_time / $clockTime;
|
||||
// Format for display or logging
|
||||
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
||||
|
8
news.php
8
news.php
@ -9,9 +9,9 @@
|
||||
* News frontend
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||
* $Revision: 1.17 $
|
||||
* $Date: 2009-08-28 15:30:24 $
|
||||
* $Author: marj_nl_fr $
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 2009-09-13 10:29:56 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
require_once("class2.php");
|
||||
@ -653,7 +653,7 @@ function checkCache($cacheString){
|
||||
|
||||
function renderCache($cache, $nfp = FALSE){
|
||||
global $pref,$tp,$sql,$CUSTOMFOOTER, $FOOTER,$cust_footer,$ph;
|
||||
global $db_debug,$ns,$eTraffic,$eTimingStart, $error_handler, $db_time, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb,$e107;
|
||||
global $db_debug,$ns,$eTimingStart, $error_handler, $db_time, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb,$e107;
|
||||
echo $cache;
|
||||
if (isset($nfp) && isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
|
||||
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
||||
|
Loading…
x
Reference in New Issue
Block a user