1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-07 19:35:47 +02:00

Debug display tweaks

This commit is contained in:
CaMer0n 2009-08-17 15:45:20 +00:00
parent aaf596e938
commit 96cc442d50
4 changed files with 27 additions and 22 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.42 $ | $Revision: 1.43 $
| $Date: 2009-08-17 12:48:52 $ | $Date: 2009-08-17 15:45:20 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -612,11 +612,13 @@ function update_706_to_800($type='')
// Tables whose definition needs changing significantly // Tables whose definition needs changing significantly
$debugLevel = E107_DBG_SQLDETAILS;
foreach ($changed_tables as $ct) foreach ($changed_tables as $ct)
{ {
$req_defs = $db_parser->get_table_def($ct,e_ADMIN."sql/core_sql.php"); $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 $req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions
if (E107_DBG_FILLIN8) echo "Required table structure: <br />".$db_parser->make_field_list($req_fields); if ($debugLevel) echo "Required table structure: <br />".$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 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); // echo $db_parser->make_table_list($actual_defs);
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if (E107_DBG_FILLIN8) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields); if ($debugLevel) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields);
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if ($just_check) return update_needed("Field changes rqd; table: ".$ct); if ($just_check) return update_needed("Field changes rqd; table: ".$ct);
// Do the changes here // Do the changes here
if (E107_DBG_FILLIN8) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs); if ($debugLevel) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs);
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."<br />"; if ($debugLevel) echo "Update Query used: ".$qry."<br />";
$sql->db_Select_gen($qry); $sql->db_Select_gen($qry);
$updateMessages[] = LAN_UPDATE_47.$ct; $updateMessages[] = LAN_UPDATE_47.$ct;
catch_error(); catch_error();

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/db_debug_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/db_debug_class.php,v $
| $Revision: 1.11 $ | $Revision: 1.12 $
| $Date: 2009-07-21 14:20:13 $ | $Date: 2009-08-17 15:45:20 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -58,7 +58,7 @@ class e107_db_debug {
function Show_All() function Show_All()
{ {
global $eTraffic; global $eTraffic;
$this->ShowIf('Debug Log', $this->Show_Log()); $this->ShowIf('Debug Log', $this->Show_Log());
$this->ShowIf('Traffic Counters', $eTraffic->Display()); $this->ShowIf('Traffic Counters', $eTraffic->Display());
$this->ShowIf('Time Analysis', $this->Show_Performance()); $this->ShowIf('Time Analysis', $this->Show_Performance());
@ -235,7 +235,7 @@ class e107_db_debug {
// //
// Optionally list good queries // Optionally list good queries
// //
if ($okCount && E107_DBG_SQLQUERIES) { if ($okCount && E107_DBG_SQLDETAILS) {
$text .= "\n<table class='fborder'>\n"; $text .= "\n<table class='fborder'>\n";
$text .= "<tr><td class='fcaption' colspan='3'><b>{$okCount[TRUE]} Good Queries</b></td></tr>\n"; $text .= "<tr><td class='fcaption' colspan='3'><b>{$okCount[TRUE]} Good Queries</b></td></tr>\n";
$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Qtime</b></td><td class='fcaption'><b>Query</b></td></tr>\n $text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Qtime</b></td><td class='fcaption'><b>Query</b></td></tr>\n

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2009-06-29 21:26:58 $ | $Date: 2009-08-17 15:45:20 $
| $Author: e107steved $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -503,6 +503,8 @@ class db_table_admin
{ {
global $sql; global $sql;
// Pull out table name // Pull out table name
$debugLevel = E107_DBG_SQLDETAILS;
$tableName = $newStructure[1]; $tableName = $newStructure[1];
if (!$sql->db_Table_exists($tableName)) if (!$sql->db_Table_exists($tableName))
{ {
@ -511,7 +513,7 @@ class db_table_admin
return 'Error creating new table: '.$tableName; return 'Error creating new table: '.$tableName;
} }
$reqFields = $this->parse_field_defs($newStructure[2]); // Required field definitions $reqFields = $this->parse_field_defs($newStructure[2]); // Required field definitions
if (E107_DBG_FILLIN8) { echo "Required table structure: <br />".$this->make_field_list($reqFields); } if ($debugLevel) { echo "Required table structure: <br />".$this->make_field_list($reqFields); }
if ((($actualDefs = $this->get_current_table($tableName)) === FALSE) || !is_array($actualDefs)) // Get actual table definition (Adds current default prefix) 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); // echo $db_parser->make_table_list($actual_defs);
$actualFields = $this->parse_field_defs($actualDefs[0][2]); // Split into field definitions $actualFields = $this->parse_field_defs($actualDefs[0][2]); // Split into field definitions
if (E107_DBG_FILLIN8) { echo 'Actual table structure: <br />'.$this->make_field_list($actualFields); } if ($debugLevel) { echo 'Actual table structure: <br />'.$this->make_field_list($actualFields); }
$diffs = $this->compare_field_lists($reqFields,$actualFields); // Work out any differences $diffs = $this->compare_field_lists($reqFields,$actualFields); // Work out any differences
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if ($justCheck) { return 'Field changes rqd; table: '.$tableName.'<br />'; } if ($justCheck) { return 'Field changes rqd; table: '.$tableName.'<br />'; }
// Do the changes here // Do the changes here
if (E107_DBG_FILLIN8) { echo "List of changes found:<br />".$this->make_changes_list($diffs); } if ($debugLevel) { echo "List of changes found:<br />".$this->make_changes_list($diffs); }
$qry = 'ALTER TABLE '.MPREFIX.$tableName.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$tableName.' '.implode(', ',$diffs[1]);
if (E107_DBG_FILLIN8) { echo 'Update Query used: '.$qry.'<br />'; } if ($debugLevel) { echo 'Update Query used: '.$qry.'<br />'; }
if ($mlUpdate) if ($mlUpdate)
{ {
$ret = $sql->db_Query_all($qry); // Returns TRUE = success, FALSE = fail $ret = $sql->db_Query_all($qry); // Returns TRUE = success, FALSE = fail

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/traffic_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/traffic_class.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:33:58 $ | $Date: 2009-08-17 15:45:20 $
| $Author: mcfly_e107 $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -167,13 +167,14 @@ class e107_traffic {
} }
function Display() { 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 ''; return '';
} }
$text = ''; $text = '';
@include_once(e_HANDLER.'traffic_class_display.php'); @include_once(e_HANDLER.'traffic_class_display.php');
return $text; return $text;
} }
} }