X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fstats-functions.php;h=816be3410d7a723eb21656bb336bc1afe907cddc;hb=517ed50cc4e716f1d34fbfc3a1befcba591eb698;hp=130e9ae2b3c919426fe7ee7219f3f00fd528ec98;hpb=56931cd9321119dd37372bd16d6c552857e40066;p=mailer.git diff --git a/inc/stats-functions.php b/inc/stats-functions.php index 130e9ae2b3..816be3410d 100644 --- a/inc/stats-functions.php +++ b/inc/stats-functions.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { // Init stats system function initStatsSystem () { // Is stats cache loaded? - if ((!isset($GLOBALS['stats_loaded'])) && (ifStatsAreEnabled())) { + if ((!isset($GLOBALS['stats_loaded'])) && (ifInternalStatsEnabled())) { // Init statistics array $GLOBALS['stats'] = array(); @@ -57,14 +57,17 @@ function initStatsSystem () { // Checks if we have a statistics entry function isStatsEntrySet ($entry) { - // Do we have the entry? + // Is there the entry? return (isset($GLOBALS['stats'][$entry])); } // Increments a statistics entry function incrementStatsEntry ($entry, $amount=1) { - // Do we have stats enabled? - if (!ifStatsAreEnabled()) return; + // Is there stats enabled? + if ((!ifInternalStatsEnabled()) && ($entry != 'db_hits')) { + // Abort here + return; + } // END - if // Is it there? if (isStatsEntrySet($entry)) { @@ -72,7 +75,7 @@ function incrementStatsEntry ($entry, $amount=1) { $GLOBALS['stats'][$entry] += $amount; } else { // Write it - $GLOBALS['stats'][$entry] = $amount; + setStatsEntry($entry, $amount); } } @@ -101,7 +104,7 @@ function loadStatsTable () { // Check if the link is up if (!SQL_IS_LINK_UP()) return false; - // Do we have it there for today? + // Is it there for today? if (!isStatsTableCreated()) { // Then create a default one createStatsTable(); @@ -131,7 +134,7 @@ function isStatsTableCreated () { $result = SQL_QUERY_ESC("SHOW TABLES LIKE '{?_MYSQL_PREFIX?}_stats_%s'", array(generateDateTime(time(), '6')), __FUNCTION__, __LINE__); - // Do we have a row? + // Is there a row? return SQL_NUMROWS($result); } @@ -174,9 +177,21 @@ function writeStatsTable () { // Filter for flushing statistics function FILTER_FLUSH_STATS () { // Now do we have stats? - if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (ifStatsAreEnabled())) { + if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (ifInternalStatsEnabled())) { // Write statistics to temporary table writeStatsTable(); + + // Count db/cache hits in database + updateConfiguration( + array( + 'db_hits', + 'cache_hits' + ), array( + getStatsEntry('db_hits'), + getStatsEntry('cache_hits') + ), + '+' + ); } // END - if }