$test['type'] = 0;
$test['test'] = $go_debug ? _("Yes") : _("No");
$test['result'] = $go_debug != 0;
- $test['comments'] = _('To switch debugging on set $go_debug=1 in config.php file');
+ $test['comments'] = _('To switch debugging on set $go_debug>1 in config.php file');
return $test;
}
// Special value 'syslog' can be used for system logger usage (see php manual).
//$error_logfile = '';
$error_logfile = dirname(__FILE__).'/tmp/errors.log';
- $debug = 1;
- $show_sql = 0;
- $go_debug = 0;
- $pdf_debug = 0;
+ $debug = 1; // show sql on database errors
+
+ $show_sql = 0; // show all sql queries in page footer for debugging purposes
+ $go_debug = 0; // set to 1 for basic debugging, or 2 to see also backtrace after failure.
+ $pdf_debug = 0; // display pdf source instead reports for debugging when $go_debug!=0
// set $sql_trail to 1 only if you want to perform bugtracking sql trail
// Warning: this produces huge amount of data in sql_trail table.
// Don't forget switch the option off and flush the table manually after
//
$sql_trail = 0; // save all sql queries in sql_trail
$select_trail = 0; // track also SELECT queries
- if ($go_debug == 1)
+ if ($go_debug > 0)
{
error_reporting(E_ALL);
ini_set("display_errors", "On");
function db_query($sql, $err_msg=null)
{
- global $db, $show_sql, $sql_trail, $select_trail, $go_debug;
+ global $db, $show_sql, $sql_trail, $select_trail, $go_debug, $sql_queries, $Ajax;
if ($show_sql)
{
- echo "<font face=arial size=2 color=000099><b>SQL..</b></font>";
- echo "<pre>";
- echo $sql;
- echo "</pre>\n";
+ $Ajax->activate('footer_debug');
+ $sql_queries .= "<pre>$sql</pre>\n<hr>";
}
-
$result = mysql_query($sql, $db);
if($sql_trail) {
function display_db_error($msg, $sql_statement=null, $exit=true)
{
- global $db, $debug;
+ global $db, $debug, $go_debug;
$warning = $msg==null;
$db_error = db_error_no();
if ($debug == 1)
{
$str .= "sql that failed was : " . $sql_statement . "<br>";
+ if ($go_debug > 1) display_backtrace();
}
$str .= "<br><br>";
***********************************************************************/
function page_footer($no_menu=false, $is_index=false, $hide_back_link=false)
{
- global $path_to_root, $js_lib, $Validate, $Editors, $Ajax;
+ global $path_to_root, $js_lib, $Validate, $Editors, $Ajax, $sql_queries;
include_once($path_to_root."/themes/".user_theme()."/renderer.php");
$rend = new renderer();
foreach($js_lib as $text)
echo $text;
echo "\n--></script>\n";
+
+ if ($sql_queries) {
+ div_start('footer_debug');
+ echo "<div class='note_msg'>$sql_queries</div>";
+ div_end();
+ }
echo "</body></html>\n";
}