Skip to content

Instantly share code, notes, and snippets.

@pvledoux
Created August 3, 2012 08:12
Show Gist options
  • Save pvledoux/3245700 to your computer and use it in GitHub Desktop.
Save pvledoux/3245700 to your computer and use it in GitHub Desktop.
Better Error DB file for ExpressionEngine ./system/expressionengine/errors/error_db.php
<html>
<head>
<title>Database Error</title>
<style type="text/css">
body {
background-color: #fff;
margin: 40px;
font-family: Lucida Grande, Verdana, Sans-serif;
font-size: 12px;
color: #000;
}
#content {
border: #999 1px solid;
background-color: #fff;
padding: 20px 20px 12px 20px;
}
h1 {
font-weight: normal;
font-size: 14px;
color: #990000;
margin: 0 0 4px 0;
}
</style>
</head>
<body>
<div id="content">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
<?php
$backtracel = '';
$count = 0;
$first = FALSE;
foreach(debug_backtrace() as $k => $v)
{
if ( ! isset($v['file'])) continue;
if ( ! $first)
{
if (isset($v['function']) AND
$v['function'] == 'display_error')
{
$first = TRUE;
}
continue;
}
if( $v['function'] == "include" OR
$v['function'] == "include_once" OR
$v['function'] == "require_once" OR
$v['function'] == "require")
{
$args = isset($v['args'][0]) ? $v['args'][0] : '';
$backtracel .= $count . ") <strong>" . $v['function'] .
"(" . $args . ")</strong> called at [" .
$v['file'] . ": " . $v['line'] . "]<br />";
}
else
{
$backtracel .= $count . ") <strong>" . $v['function'] .
"()</strong> called at [" . $v['file'] .
": " . $v['line'] . "]<br />";
}
$count++;
}
echo '<hr/>';
echo $backtracel;
?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment