From 96cc442d50bf480c23162a192186873bfca0703c Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Mon, 17 Aug 2009 15:45:20 +0000 Subject: [PATCH] Debug display tweaks --- e107_admin/update_routines.php | 14 ++++++++------ e107_handlers/db_debug_class.php | 8 ++++---- e107_handlers/db_table_admin_class.php | 16 +++++++++------- e107_handlers/traffic_class.php | 11 ++++++----- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index c60fa2593..78dd224b6 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ -| $Revision: 1.42 $ -| $Date: 2009-08-17 12:48:52 $ +| $Revision: 1.43 $ +| $Date: 2009-08-17 15:45:20 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -612,11 +612,13 @@ function update_706_to_800($type='') // Tables whose definition needs changing significantly + $debugLevel = E107_DBG_SQLDETAILS; + foreach ($changed_tables as $ct) { $req_defs = $db_parser->get_table_def($ct,e_ADMIN."sql/core_sql.php"); $req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions - if (E107_DBG_FILLIN8) echo "Required table structure:
".$db_parser->make_field_list($req_fields); + if ($debugLevel) echo "Required table structure:
".$db_parser->make_field_list($req_fields); if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix { @@ -626,16 +628,16 @@ function update_706_to_800($type='') { // echo $db_parser->make_table_list($actual_defs); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); - if (E107_DBG_FILLIN8) echo "Actual table structure:
".$db_parser->make_field_list($actual_fields); + if ($debugLevel) echo "Actual table structure:
".$db_parser->make_field_list($actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); if (count($diffs[0])) { // Changes needed if ($just_check) return update_needed("Field changes rqd; table: ".$ct); // Do the changes here - if (E107_DBG_FILLIN8) echo "List of changes found:
".$db_parser->make_changes_list($diffs); + if ($debugLevel) echo "List of changes found:
".$db_parser->make_changes_list($diffs); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); - if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."
"; + if ($debugLevel) echo "Update Query used: ".$qry."
"; $sql->db_Select_gen($qry); $updateMessages[] = LAN_UPDATE_47.$ct; catch_error(); diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index b884f9aba..4e15e1f66 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/db_debug_class.php,v $ -| $Revision: 1.11 $ -| $Date: 2009-07-21 14:20:13 $ +| $Revision: 1.12 $ +| $Date: 2009-08-17 15:45:20 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -58,7 +58,7 @@ class e107_db_debug { function Show_All() { global $eTraffic; - + $this->ShowIf('Debug Log', $this->Show_Log()); $this->ShowIf('Traffic Counters', $eTraffic->Display()); $this->ShowIf('Time Analysis', $this->Show_Performance()); @@ -235,7 +235,7 @@ class e107_db_debug { // // Optionally list good queries // - if ($okCount && E107_DBG_SQLQUERIES) { + if ($okCount && E107_DBG_SQLDETAILS) { $text .= "\n\n"; $text .= "\n"; $text .= "\n diff --git a/e107_handlers/db_table_admin_class.php b/e107_handlers/db_table_admin_class.php index 127c3f687..7bd0dbecb 100644 --- a/e107_handlers/db_table_admin_class.php +++ b/e107_handlers/db_table_admin_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $ -| $Revision: 1.8 $ -| $Date: 2009-06-29 21:26:58 $ -| $Author: e107steved $ +| $Revision: 1.9 $ +| $Date: 2009-08-17 15:45:20 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -503,6 +503,8 @@ class db_table_admin { global $sql; // Pull out table name + $debugLevel = E107_DBG_SQLDETAILS; + $tableName = $newStructure[1]; if (!$sql->db_Table_exists($tableName)) { @@ -511,7 +513,7 @@ class db_table_admin return 'Error creating new table: '.$tableName; } $reqFields = $this->parse_field_defs($newStructure[2]); // Required field definitions - if (E107_DBG_FILLIN8) { echo "Required table structure:
".$this->make_field_list($reqFields); } + if ($debugLevel) { echo "Required table structure:
".$this->make_field_list($reqFields); } if ((($actualDefs = $this->get_current_table($tableName)) === FALSE) || !is_array($actualDefs)) // Get actual table definition (Adds current default prefix) { @@ -521,16 +523,16 @@ class db_table_admin { // echo $db_parser->make_table_list($actual_defs); $actualFields = $this->parse_field_defs($actualDefs[0][2]); // Split into field definitions - if (E107_DBG_FILLIN8) { echo 'Actual table structure:
'.$this->make_field_list($actualFields); } + if ($debugLevel) { echo 'Actual table structure:
'.$this->make_field_list($actualFields); } $diffs = $this->compare_field_lists($reqFields,$actualFields); // Work out any differences if (count($diffs[0])) { // Changes needed if ($justCheck) { return 'Field changes rqd; table: '.$tableName.'
'; } // Do the changes here - if (E107_DBG_FILLIN8) { echo "List of changes found:
".$this->make_changes_list($diffs); } + if ($debugLevel) { echo "List of changes found:
".$this->make_changes_list($diffs); } $qry = 'ALTER TABLE '.MPREFIX.$tableName.' '.implode(', ',$diffs[1]); - if (E107_DBG_FILLIN8) { echo 'Update Query used: '.$qry.'
'; } + if ($debugLevel) { echo 'Update Query used: '.$qry.'
'; } if ($mlUpdate) { $ret = $sql->db_Query_all($qry); // Returns TRUE = success, FALSE = fail diff --git a/e107_handlers/traffic_class.php b/e107_handlers/traffic_class.php index 7d82a49f0..387304d63 100644 --- a/e107_handlers/traffic_class.php +++ b/e107_handlers/traffic_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/traffic_class.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:33:58 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2009-08-17 15:45:20 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -167,13 +167,14 @@ class e107_traffic { } function Display() { - if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) { + if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC || E107_DBG_BASIC) // 'Basic' should not display Traffic. + { return ''; } $text = ''; @include_once(e_HANDLER.'traffic_class_display.php'); - return $text; + return $text; } }
{$okCount[TRUE]} Good Queries
IndexQtimeQuery