]> git.mxchange.org Git - mailer.git/blobdiff - inc/stats-functions.php
mailer project continued:
[mailer.git] / inc / stats-functions.php
index 343a7c510c7284794fb4176ccb5230a0a2a7abc9..a965d71c155d583598a8b2fb052e26ba1bfdd02c 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * 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 *
@@ -64,7 +64,8 @@ function isStatsEntrySet ($entry) {
 // Increments a statistics entry
 function incrementStatsEntry ($entry, $amount=1) {
        // Do we have stats enabled?
-       if (!ifInternalStatsEnabled()) {
+       if ((!ifInternalStatsEnabled()) && ($entry != 'db_hits')) {
+               // Abort here
                return;
        } // END - if
 
@@ -74,7 +75,7 @@ function incrementStatsEntry ($entry, $amount=1) {
                $GLOBALS['stats'][$entry] += $amount;
        } else {
                // Write it
-               $GLOBALS['stats'][$entry] = $amount;
+               setStatsEntry($entry, $amount);
        }
 }
 
@@ -179,6 +180,18 @@ function FILTER_FLUSH_STATS () {
        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
 }