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