Added code to only show debug status when not an AJAX call.
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Sep 2019 16:45:26 +0000 (12:45 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Sep 2019 16:45:26 +0000 (12:45 -0400)
defines.php
index.php

index 6661ba5..46361b6 100755 (executable)
@@ -6,7 +6,7 @@
  */
 
 // Set to true to add more debug messages to the error log
-define('GLM_SERVERSTATS_PLUGIN_DEBUG', false);
+define('GLM_SERVERSTATS_PLUGIN_DEBUG', true);
 
 // Database Connection
 define('GLM_SERVERSTATS_DATABASE_NAME',     'bandwidth');
index 4dfc05b..4ba66b6 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -194,7 +194,7 @@ if ($websiteSettings['show_cookie_popup'] && !is_admin()) {
  */
 function glmServerStatsAjax()
 {
-
+    $glmAjaxActionCalled = true;
     $glmAction = false;
 
     // Get the requested model
@@ -204,7 +204,7 @@ function glmServerStatsAjax()
 
     // Call controller to handle AJAX request - Ajax models should not return to controller
     if ($glmAction && $glmAction != '') {
-        serverStatsController($glmAction);
+        serverStatsController($glmAction, true);
     }
 
 }
@@ -217,7 +217,7 @@ function glmServerStatsAjax()
  * model and the view.
  *
  */
-function serverStatsController($model)
+function serverStatsController($model, $isAjax = false)
 {
 
     if (GLM_SERVERSTATS_PLUGIN_DEBUG) {
@@ -225,6 +225,10 @@ function serverStatsController($model)
         trigger_error("GLM Usage Controller Start: Model = $model", E_USER_NOTICE );
     }
 
+    if (GLM_SERVERSTATS_PLUGIN_DEBUG && !$isAjax) {
+        trigger_error("GLM Usage Plugin Debug Enabled: *** Turn off for production *** - See defines.php", E_USER_NOTICE );
+    }
+
     // Enque admin scripts and css here so that only happens when we're doing something
     glmServerJqueryScipts();
     glmServerStatsScripts();