]> git.mxchange.org Git - mailer.git/blobdiff - inc/stats-functions.php
Module-related code moved, deprecated templates deleted, internals stats are now...
[mailer.git] / inc / stats-functions.php
index 338f3b833adab7d1920438ea6c89e070d8c4b6a3..3982c3b6110bdf2393a5cb803368c663b0abc628 100644 (file)
@@ -45,7 +45,7 @@ if (!defined('__SECURITY')) {
 // Init stats system
 function initStatsSystem () {
        // Is stats cache loaded?
-       if ((!isset($GLOBALS['stats_loaded'])) && (getConfig('STATS_ENABLED') == 'Y')) {
+       if ((!isset($GLOBALS['stats_loaded'])) && (ifStatsAreEnabled())) {
                // Init statistics array
                $GLOBALS['stats'] = array();
 
@@ -66,7 +66,7 @@ function isStatsEntrySet ($entry) {
 // Increments a statistics entry
 function incrementStatsEntry ($entry, $amount=1) {
        // Do we have stats enabled?
-       if (getConfig('STATS_ENABLED') != 'Y') return;
+       if (getConfig('stats_enabled') != 'Y') return;
 
        // Is it there?
        if (isStatsEntrySet($entry)) {
@@ -174,11 +174,25 @@ function writeStatsTable () {
 // Filter for flushing statistics
 function FILTER_FLUSH_STATS () {
        // Now do we have stats?
-       if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (getConfig('STATS_ENABLED') == 'Y')) {
+       if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (ifStatsAreEnabled())) {
                // Write statistics to temporary table
                writeStatsTable();
        } // END - if
 }
 
+// Check wether stats are enabled
+function ifStatsAreEnabled () {
+       logDebugMessage(__FUNCTION__, __LINE__, 'CALLED!');
+
+       // Do we have cache?
+       if (!isset($GLOBALS['stats_enabled'])) {
+               // Then determine it
+               $GLOBALS['stats_enabled'] = (getConfig('stats_enabled') == 'Y');
+       } // END - if
+
+       // Return cached value
+       return $GLOBALS['stats_enabled'];
+}
+
 // [EOF]
 ?>