- Timestamp:
- 01/27/11 02:58:32 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.9/amp_conf/htdocs/admin/libraries/utility.functions.php
r11145 r11146 23 23 $bt = debug_backtrace(); 24 24 25 if ($bt[1]['function'] == 'out' ) {25 if ($bt[1]['function'] == 'out' || $bt[1]['function'] == 'die_freepbx') { 26 26 $file_full = $bt[1]['file']; 27 27 $line = $bt[1]['line']; … … 82 82 83 83 function die_freepbx($text, $extended_text="", $type="FATAL") { 84 $trace = print_r(debug_backtrace(),true); 84 global $amp_conf; 85 86 $bt = debug_backtrace(); 87 freepbx_log(FPBX_LOG_FATAL, "die_freepbx(): ".$text); 88 85 89 if (isset($_SERVER['REQUEST_METHOD'])) { 86 90 // running in webserver 87 echo"<h1>".$type." ERROR</h1>\n";88 echo"<h3>".$text."</h3>\n";91 $trace = "<h1>".$type." ERROR</h1>\n"; 92 $trace .= "<h3>".$text."</h3>\n"; 89 93 if (!empty($extended_text)) { 90 echo"<p>".$extended_text."</p>\n";94 $trace .= "<p>".$extended_text."</p>\n"; 91 95 } 92 echo "<h4>"._("Trace Back")."</h4>"; 93 echo "<pre>$trace</pre>"; 96 $trace .= "<h4>"._("Trace Back")."</h4>"; 97 98 $main_fmt = "%s:%s %s()<br />\n"; 99 $arg_fmt = " [%s]: %s<br />\n"; 100 $separator = "<br />\n"; 101 $tail = "<br />\n"; 102 $f = 'htmlspecialchars'; 94 103 } else { 95 104 // CLI 96 echo "[$type] ".$text." ".$extended_text."\n"; 97 echo "Trace Back:\n"; 98 echo $trace; 99 } 100 101 // always ensure we exit at this point 105 $trace = "[$type] ".$text." ".$extended_text."\n\n"; 106 $trace .= "Trace Back:\n\n"; 107 108 $main_fmt = "%s:%s %s()\n"; 109 $arg_fmt = " [%s]: %s\n"; 110 $separator = "\n"; 111 $tail = ""; 112 $f = 'trim'; 113 } 114 115 foreach ($bt as $l) { 116 $cl = isset($l['class']) ? $f($l['class']) : ''; 117 $ty = isset($l['type']) ? $f($l['type']) : ''; 118 $func = $f($cl . $ty . $l['function']); 119 $trace .= sprintf($main_fmt, $l['file'], $l['line'], $func); 120 if (isset($l['args'])) foreach ($l['args'] as $i => $a) { 121 $trace .= sprintf($arg_fmt, $i, $f($a)); 122 } 123 $trace .= $separator; 124 } 125 echo $trace . $tail; 126 127 if ($amp_conf['DIE_FREEPBX_VERBOSE']) { 128 $trace = print_r($bt,true); 129 if (isset($_SERVER['REQUEST_METHOD'])) { 130 echo '<pre>' .$trace. '</pre>'; 131 } else { 132 echo $trace; 133 } 134 } 135 136 // Now die! 102 137 exit(1); 103 138 } freepbx/branches/2.9/libfreepbx.install.php
r11128 r11146 1197 1197 $freepbx_conf->define_conf_setting('FPBXDBUGDISABLE',$set); 1198 1198 1199 // DIE_FREEPBX_VERBOSE 1200 $set['value'] = false; 1201 $set['options'] = ''; 1202 $set['name'] = 'Provide Verbose Tracebacks'; 1203 $set['description'] = 'Provides a very verbose traceback when die_freepbx() is called including extensive object details if present in the traceback.'; 1204 $set['emptyok'] = 0; 1205 $set['readonly'] = 0; 1206 $set['type'] = CONF_TYPE_BOOL; 1207 $freepbx_conf->define_conf_setting('DIE_FREEPBX_VERBOSE',$set); 1208 1209 1210 1199 1211 // DEVEL 1200 1212 $set['value'] = false;
