mirror of
https://github.com/e107inc/e107.git
synced 2025-08-16 19:44:09 +02:00
Core Cleanup.
This commit is contained in:
@@ -122,6 +122,11 @@
|
||||
}
|
||||
|
||||
function Mark_Time($sMarker)
|
||||
{
|
||||
$this->logTime($sMarker);
|
||||
}
|
||||
|
||||
public function logTime($sMarker)
|
||||
{ // Should move to traffic_class?
|
||||
$timeNow = microtime();
|
||||
$nMarks = ++$this->nTimeMarks;
|
||||
|
@@ -5250,6 +5250,7 @@ return;
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$dbg = e107::getDebug();
|
||||
|
||||
// $html = $this->getXss();
|
||||
|
||||
@@ -5260,20 +5261,20 @@ return;
|
||||
echo "<h2>Standard v2 Parser</h2>";
|
||||
echo "<h3>\$tp->dataFilter()</h3>";
|
||||
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
|
||||
$sql->db_Mark_Time('------ Start Parser Test -------');
|
||||
$dbg->logTime('------ Start Parser Test -------');
|
||||
print_a($tp->dataFilter($html));
|
||||
$sql->db_Mark_Time('tp->dataFilter');
|
||||
$dbg->logTime('tp->dataFilter');
|
||||
|
||||
echo "<h3>\$tp->toHTML()</h3>";
|
||||
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
|
||||
print_a($tp->toHTML($html));
|
||||
$sql->db_Mark_Time('tp->toHtml');
|
||||
$dbg->logTime('tp->toHtml');
|
||||
|
||||
echo "<h3>\$tp->toDB()</h3>";
|
||||
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
|
||||
$todb = $tp->toDB($html);
|
||||
print_a( $todb);
|
||||
$sql->db_Mark_Time('tp->toDB');
|
||||
$dbg->logTime('tp->toDB');
|
||||
|
||||
echo "<h3>\$tp->toForm() with toDB input.</h3>";
|
||||
print_a( $tp->toForm($todb));
|
||||
@@ -5282,8 +5283,8 @@ return;
|
||||
echo "<h3>Processed</h3>";
|
||||
$cleaned = $this->cleanHtml($html, true); // false = don't check html pref.
|
||||
print_a($cleaned);
|
||||
$sql->db_Mark_Time('new Parser');
|
||||
// $sql->db_Mark_Time('------ End Parser Test -------');
|
||||
$dbg->logTime('new Parser');
|
||||
// $dbg->logTime('------ End Parser Test -------');
|
||||
echo "<h3>Processed & Rendered</h3>";
|
||||
echo $cleaned;
|
||||
|
||||
|
@@ -1262,7 +1262,7 @@ class e_jsmanager
|
||||
if($label && E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
echo $external ? "<!-- [JSManager] ".$label." -->\n" : "/* [JSManager] ".$label." */\n\n";
|
||||
e107::getDb()->db_Mark_Time("Load JS/CSS: ".$label);
|
||||
e107::getDebug()->logTime("Load JS/CSS: ".$label);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -627,7 +627,7 @@ class e_menu
|
||||
{
|
||||
echo "\n<!-- Menu Start: ".$mname." -->\n";
|
||||
}
|
||||
e107::getDb()->db_Mark_Time($mname);
|
||||
e107::getDebug()->logTime($mname);
|
||||
|
||||
if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu
|
||||
{
|
||||
@@ -696,7 +696,7 @@ class e_menu
|
||||
|
||||
deftrue('e_DEBUG') ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
|
||||
}
|
||||
e107::getDb()->db_Mark_Time("(After ".$mname.")");
|
||||
e107::getDebug()->logTime("(After ".$mname.")");
|
||||
|
||||
if(e_DEBUG === true)
|
||||
{
|
||||
|
@@ -310,6 +310,7 @@ class e_db_mysql implements e_db
|
||||
/**
|
||||
* @return void
|
||||
* @param string $sMarker
|
||||
* @deprecated Use e107::getDebug()->logTime();
|
||||
* @desc Enter description here...
|
||||
* @access private
|
||||
*/
|
||||
|
@@ -95,6 +95,7 @@ class e_online
|
||||
|
||||
$sql = e107::getDb();
|
||||
$user = e107::getUser();
|
||||
$dbg = e107::getDebug();
|
||||
|
||||
$online_timeout = 300;
|
||||
|
||||
@@ -141,14 +142,14 @@ class e_online
|
||||
// don't do anything if main admin logged in as another user
|
||||
if ($user->isUser() && !$user->getParentId())
|
||||
{
|
||||
$sql->db_Mark_Time('Go online (isUser)');
|
||||
$dbg->logTime('Go online (isUser)');
|
||||
// Find record that matches IP or visitor, or matches user info
|
||||
$sql->db_Mark_Time('Go online (db select)');
|
||||
$dbg->logTime('Go online (db select)');
|
||||
if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}' LIMIT 1"))
|
||||
{
|
||||
$sql->db_Mark_Time('Go online (db fetch)');
|
||||
$dbg->logTime('Go online (db fetch)');
|
||||
$row = $sql->fetch();
|
||||
$sql->db_Mark_Time('Go online (db end)');
|
||||
$dbg->logTime('Go online (db end)');
|
||||
|
||||
if ($row['online_user_id'] == $udata)
|
||||
{
|
||||
@@ -234,19 +235,19 @@ class e_online
|
||||
$query['online_location'] = $page;
|
||||
}
|
||||
|
||||
$sql->db_Mark_Time('Go online (update) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (update) Line:'.__LINE__);
|
||||
$sql->update('online', $query);
|
||||
$sql->db_Mark_Time('Go online (after update) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (after update) Line:'.__LINE__);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql->db_Mark_Time('Go online (insert) Line: '.__LINE__);
|
||||
$dbg->logTime('Go online (insert) Line: '.__LINE__);
|
||||
$sql->insert('online',$insert_query);
|
||||
$sql->db_Mark_Time('Go online (after insert) Line: '.__LINE__);
|
||||
$dbg->logTime('Go online (after insert) Line: '.__LINE__);
|
||||
}
|
||||
|
||||
$sql->db_Mark_Time('Go online (after isUser)');
|
||||
$dbg->logTime('Go online (after isUser)');
|
||||
}
|
||||
// don't do anything if main admin logged in as another user
|
||||
elseif(!$user->getParentId())
|
||||
@@ -268,9 +269,9 @@ class e_online
|
||||
// echo "here {$online_pagecount}";
|
||||
$query="`online_pagecount` = {$row['online_pagecount']}{$update_page} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
|
||||
}
|
||||
$sql->db_Mark_Time('Go online (update) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (update) Line:'.__LINE__);
|
||||
$sql->update('online', $query);
|
||||
$sql->db_Mark_Time('Go online (after update) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (after update) Line:'.__LINE__);
|
||||
}
|
||||
else
|
||||
{ // New visitor
|
||||
@@ -312,12 +313,12 @@ class e_online
|
||||
// Speed up ajax requests
|
||||
if(!deftrue('e_AJAX_REQUEST'))
|
||||
{
|
||||
$sql->db_Mark_Time('Go online (delete) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (delete) Line:'.__LINE__);
|
||||
$sql->delete('online', '`online_timestamp` < '.(time() - $online_timeout));
|
||||
|
||||
// FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline()
|
||||
// $total_online = $sql->db_Count('online'); // 1 less query! :-)
|
||||
$sql->db_Mark_Time('Go online (total_online) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (total_online) Line:'.__LINE__);
|
||||
if ($total_online = $sql->gen('SELECT o.*,u.user_image FROM `#online` AS o LEFT JOIN `#user` AS u ON o.online_user_id = u.user_id WHERE o.online_pagecount > 0 ORDER BY o.online_timestamp DESC'))
|
||||
// if ($total_online = $sql->gen('SELECT o FROM `#online` WHERE o.online_pagecount > 0 ORDER BY o.online_timestamp DESC'))
|
||||
{
|
||||
@@ -325,7 +326,7 @@ class e_online
|
||||
$members_online = 0;
|
||||
$listuserson = array();
|
||||
|
||||
$sql->db_Mark_Time('Go online (db fetch) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (db fetch) Line:'.__LINE__);
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
|
||||
@@ -373,7 +374,7 @@ class e_online
|
||||
define('TOTAL_ONLINE', $total_online);
|
||||
define('MEMBERS_ONLINE', $members_online);
|
||||
define('GUESTS_ONLINE', $total_online - $members_online);
|
||||
$sql->db_Mark_Time('Go online (db count) Line:'.__LINE__);
|
||||
$dbg->logTime('Go online (db count) Line:'.__LINE__);
|
||||
define('ON_PAGE', $sql->db_Count('online', '(*)', "WHERE `online_location` = '{$page}' "));
|
||||
define('MEMBER_LIST', $member_list);
|
||||
|
||||
|
@@ -1618,14 +1618,16 @@ class e107plugin
|
||||
// echo "Found plugin: ".$row['plugin_path']." in DB<br />";
|
||||
}
|
||||
}
|
||||
$sql->db_Mark_Time('Start Scanning Plugin Files');
|
||||
e107::getDebug()->logTime('Start Scanning Plugin Files');
|
||||
$plugList = $fl->get_files(e_PLUGIN, "^plugin\.(php|xml)$", "standard", 1);
|
||||
|
||||
foreach ($plugList as $num => $val) // Remove Duplicates caused by having both plugin.php AND plugin.xml.
|
||||
{
|
||||
$key = basename($val['path']);
|
||||
$pluginList[$key] = $val;
|
||||
}
|
||||
$sql->db_Mark_Time('After Scanning Plugin Files');
|
||||
|
||||
e107::getDebug()->logTime('After Scanning Plugin Files');
|
||||
$p_installed = e107::getPref('plug_installed', array()); // load preference;
|
||||
$mes = e107::getMessage();
|
||||
|
||||
|
@@ -1066,7 +1066,7 @@ class e_parse_shortcode
|
||||
|
||||
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
|
||||
{
|
||||
$sql->db_Mark_Time("SC ".$code);
|
||||
e107::getDebug()->logTime("SC ".$code);
|
||||
}
|
||||
|
||||
if (E107_DBG_SC && ADMIN)
|
||||
|
Reference in New Issue
Block a user