From: Chuck Scott Date: Wed, 6 Sep 2017 16:19:33 +0000 (-0400) Subject: Started depreciating front and admin debug features. X-Git-Tag: v2.10.10^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e8b2d4e1a6d1fd2a4cf3baa366d144a9f0094a56;p=WP-Plugins%2Fglm-member-db.git Started depreciating front and admin debug features. Removed debug settings from Management Menu Commented out code used to add content to debug data from plugin support. Keeping code for now to purge any remainting data from WordPress options where it stored. If no issues come up, will do a final purge of this code and all calls to save debug information form all other code. All changes are marked as "Depreciating Debug..." --- diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index d42854e0..b897983d 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -118,7 +118,7 @@ class GlmDataSettingsGeneral extends GlmDataAbstract /* * Debug Options */ - +/* Depreciating debug system // Admin Debug 'admin_debug' => array( 'field' => 'admin_debug', @@ -146,7 +146,8 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'type' => 'checkbox', 'use' => 'a' ), - +*/ + /* * Misc Settings */ diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index f7fe4f8a..dc93715f 100644 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -42,59 +42,12 @@ class GlmPluginSupport public static function addNotice ($message, $type = false, $title = false) { - update_option('glmMembersAdminHaveNotices', true); - - switch($type) { - - case 'Alert'; - $alerts = get_option('glmMembersAdminNoticeAlerts'); - $alerts[] = $message; - update_option('glmMembersAdminNoticeAlerts', $alerts); - break; - - case 'Process'; - $process = get_option('glmMembersAdminNoticeProcess'); - $process[] = $message; - update_option('glmMembersAdminNoticeProcess', $process); - break; - - case 'DataBlock'; - $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks'); - $dataBlocks[] = array('data' => $message, 'title' => $title); - update_option('glmMembersAdminNoticeDataBlocks', $dataBlocks); - break; - - case 'AdminNotice': - echo ' -
-

'.$message.'

-
- '; - break; - - case 'AdminError': - echo ' -
-

'.$message.'

-
- '; - break; - - case 'AdminNag': - echo ' -
-

'.$message.'

-
- '; - break; - - default; - $notices = get_option('glmMembersAdminNotices'); - $notices[] = $message; - update_option('glmMembersAdminNotices', $notices); - break; - - } + // Depreciating debug system - Make sure all notices are cleared + // Will delete this method after all references are purged. + + $this->clearNotices(); + + return; } @@ -137,19 +90,21 @@ class GlmPluginSupport sleep(1); // if we have pending messages, display those + // Depreciating debug system + /* if (get_option('glmMembersAdminNotices')) { glmMembersAdminNotices(); // Otherwise, there must have been some other error. } else { - + */ $installErrors = get_option('glmMembersInstallErrors'); echo 'There has been an unknown error with the Gaslight Media Members Database plugin.

'.$installErrors; delete_option('glmMembersInstallErrors'); - } + // } // Quit here so Wordpress doesn't mark plugin as activated or deactivated return true; @@ -372,7 +327,9 @@ return; // Off for now ** Need to make this switchable in management */ function glmMembersAdminNotices($windowed = true) { - + // Depreciating debug system + return; +/* $output = ''; // If windowed for debug, also include HTML header and stylesheet @@ -474,7 +431,7 @@ function glmMembersAdminNotices($windowed = true) delete_option('glmMembersAdminNotices'); delete_option('glmMembersAdminNoticeProcess'); delete_option('glmMembersAdminNoticeDataBlocks'); - +*/ } /** diff --git a/config.php b/config.php index 22c2502b..5c61c0fb 100644 --- a/config.php +++ b/config.php @@ -34,10 +34,17 @@ if ($glmMembersDatabaseDbVersion) { $config['terms'] = $terms; // Add Debug defines - These can't go into the defines.php file - Guess why. + // Depreciating debug system + define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', false); + define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', false); + define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', false); + define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', false); + /* define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', $settings['admin_debug']); define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', $settings['admin_debug_verbose']); define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG', $settings['front_debug']); define('GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE', $settings['front_debug_verbose']); + */ } // Check for config value replacements in the current theme diff --git a/controllers/admin.php b/controllers/admin.php index f5178565..84b1454d 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -768,6 +768,8 @@ class glmMembersAdmin extends GlmPluginSupport $this->addNotice('Error in Admin Controller: Menu Item not included in validActions.php!', 'Alert'); } + trigger_error('Error in Admin Controller: Menu Item not included in validActions.php!', E_USER_NOTICE); + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -784,6 +786,8 @@ class glmMembersAdmin extends GlmPluginSupport $this->addNotice('Error in Admin Controller: Requested Menu Item is invalid! - '.$menuItem, 'Alert'); } + trigger_error('Error in Admin Controller: Requested Menu Item is invalid! - '.$menuItem, E_USER_NOTICE); + $menuItem = 'error'; $action = 'badAction'; @@ -817,6 +821,8 @@ class glmMembersAdmin extends GlmPluginSupport $this->addNotice("Error in Admin Controller: Model file doesn't exist - ".$modelName, 'Alert'); } + trigger_error("Error in Admin Controller: Model file doesn't exist - ".$modelName, E_USER_NOTICE); + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -837,6 +843,8 @@ class glmMembersAdmin extends GlmPluginSupport $this->addNotice("Error in Admin Controller: Invalid Model Class Name - ".$className, 'Alert'); } + trigger_error("Error in Admin Controller: Invalid Model Class Name - ".$className, E_USER_NOTICE); + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -895,6 +903,8 @@ class glmMembersAdmin extends GlmPluginSupport $viewFile = $view; if (!is_file($viewPath.'/'.$viewFile)) { + trigger_error("Bad or missing view file: $viewPath/$view", E_USER_NOTICE); + // No matching view file found $errorMsg .= "Bad or missing view file: $viewPath/$view"; $badView = true; @@ -912,6 +922,8 @@ class glmMembersAdmin extends GlmPluginSupport $this->addNotice("Error in Admin Controller: Requested View file doesn't exist - ".$viewPath.'/'.$viewFile, 'Alert'); } + trigger_error("Error in Admin Controller: Requested View file doesn't exist - ".$viewPath.'/'.$viewFile, E_USER_NOTICE); + $modelRedirect = true; $menuItem = 'error'; $action = 'index'; @@ -925,6 +937,9 @@ class glmMembersAdmin extends GlmPluginSupport // This is just a sanity check on this loop to keep it from getting out of control if (++$loopCheck > 5) { + + trigger_error('Serious failure looping on model load!', E_USER_NOTICE); + die('

Serious failure looping on model load in "controllers/admin.php".

diff --git a/index.php b/index.php index dbfde6fc..9f85ab33 100644 --- a/index.php +++ b/index.php @@ -424,10 +424,13 @@ if (function_exists('is_user_logged_in')) { */ // If the call to this code is to display a separate debug window +// Depreciating debug feature +/* if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) { glmMembersAdminNotices(true); exit; } +*/ // If no database version was set at the top, this was an initial activation, so don't run controllers if ($glmMembersDatabaseDbVersion) { @@ -460,12 +463,15 @@ if ($startupNotices != '') { } // If not doing debug, then clear all of the debug messages that might have been saved +// Depreciating debug feature +/* if (defined('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG') && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { delete_option('glmMembersAdminNoticeAlerts'); delete_option('glmMembersAdminNotices'); delete_option('glmMembersAdminNoticeProcess'); delete_option('glmMembersAdminNoticeDataBlocks'); } +*/ /* * Check if database is installed and if it matches the current version diff --git a/uninstall.php b/uninstall.php index 306fa641..65d872c9 100644 --- a/uninstall.php +++ b/uninstall.php @@ -31,12 +31,14 @@ require_once 'defines.php'; // Delete options delete_option('glmMembersDatabasePluginVersion'); delete_option('glmMembersDatabaseDbVersion'); -delete_option('glmMembersAdminNotices'); +// Depreciating debug system +//delete_option('glmMembersAdminNotices'); // Same for Multi-site delete_site_option('glmMembersDatabasePluginVersion'); delete_site_option('glmMembersDatabaseDbVersion'); -delete_site_option('glmMembersAdminNotices'); +// Depreciating debug system +//delete_site_option('glmMembersAdminNotices'); /* * Drop database tables diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 0c9eb36b..fa207e98 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -6,8 +6,8 @@