Update for trigger errors
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 17 Sep 2019 19:52:18 +0000 (15:52 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 17 Sep 2019 19:52:18 +0000 (15:52 -0400)
Only trigger errors if DEBUG is on for this plugin.

classes/GlmServerStats.php
defines.php
views/glmInfoNotifications.html

index 6a83692..42b9a10 100644 (file)
@@ -138,7 +138,9 @@ class GlmServerStats
     {
         // If the update transient exists don't get anything from the relay.
         if ( false === ( get_transient( 'ServerStatCacheUpdate' ) ) ) {
-            trigger_error( 'running updateCache' );
+            if ( GLM_SERVERSTATS_PLUGIN_DEBUG ) {
+                trigger_error( 'running updateCache' );
+            }
             $lastUpdate   = $this->getLastUpdatedTime();
             $timestamp    = 0;
             if ( $lastUpdate ) {
@@ -163,12 +165,16 @@ class GlmServerStats
             set_transient( 'ServerStatCacheUpdate', true, 20 * MINUTE_IN_SECONDS );
 
             if ( !empty( $notices ) ) {
-                trigger_error( 'updating cache', E_USER_NOTICE );
+                if ( GLM_SERVERSTATS_PLUGIN_DEBUG ) {
+                    trigger_error( 'updating cache', E_USER_NOTICE );
+                }
                 foreach ( $notices as $notice ) {
                     $this->cacheNotice( $notice );
                 }
             } else {
-                trigger_error( 'no new ones found', E_USER_NOTICE );
+                if ( GLM_SERVERSTATS_PLUGIN_DEBUG ) {
+                    trigger_error( 'no new ones found', E_USER_NOTICE );
+                }
             }
         }
 
index 920bb17..486a395 100755 (executable)
@@ -18,7 +18,7 @@ define('GLM_SERVERSTATS_DATABASE_PASSWORD', ',Wv4W*~^bL_vF3F4PbGsS');
 define('GLM_SERVERSTATS_PROVIDER', 'www.gaslightmedia.com:192.168.44.82:localhost');         // Development System
 
 // Check if debug enabled
-if (GLM_SERVERSTATS_PLUGIN_DEBUG) {
+if ( GLM_SERVERSTATS_PLUGIN_DEBUG ) {
     trigger_error("GLM Data Usage Debug Enabled", E_USER_NOTICE);
 }
 
index 5a8ef8f..fa0532b 100644 (file)
@@ -20,7 +20,7 @@
         {if $view_type == 'main'}
             {foreach $messages as $m}
                 <div class="glm-info-message">
-                    <div>{$m.updated.datetime|date_format:$dateFormat}</div>
+                    <div>{$m.updated|strtotime|date_format:$dateFormat}</div>
                     <h2>{$m.title}</h2>
                     {$m.message}
                 </div>
@@ -34,7 +34,7 @@
                 </tr>
                 {foreach $messages as $m}
                     <tr>
-                        <td width="150"> {$m.updated.datetime|date_format:$dateFormat} </td>
+                        <td width="150"> {$m.updated|strtotime|date_format:$dateFormat} </td>
                         <td> <a href="{$admin_url}?page={$thisPage}&glm_action=index&option=view&id={$m.id}">{$m.title}</a> </td>
                         <td> {$m.dashboard_message|strip_tags} </td>
                     </tr>