provide separate logging (if configured) for btlogger which is used to catch really subtle issues which don't always leave an audit trail. Similar to dbfail.out, the file btlogger.out (if it exists and is write-able) will only log these unusual situations with backtraces so we can find the culprits.
This commit is contained in:
parent
9d49faca61
commit
f2bfdfdedd
@ -128,6 +128,11 @@ function markdown_to_bb($s, $use_zrl = false) {
|
|||||||
$s = str_replace("
","\r",$s);
|
$s = str_replace("
","\r",$s);
|
||||||
$s = str_replace("
\n>","",$s);
|
$s = str_replace("
\n>","",$s);
|
||||||
|
|
||||||
|
if(is_array($s)) {
|
||||||
|
btlogger('markdown_to_bb called with array. ' . print_r($s,true), LOGGER_NORMAL, LOG_WARNING);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
|
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
|
||||||
|
|
||||||
// if empty link text replace with the url
|
// if empty link text replace with the url
|
||||||
|
@ -634,6 +634,18 @@ function update_vcard($arr,$vcard = null) {
|
|||||||
|
|
||||||
$fn = $arr['fn'];
|
$fn = $arr['fn'];
|
||||||
|
|
||||||
|
|
||||||
|
// This isn't strictly correct and could be a cause for concern.
|
||||||
|
// 'N' => array_reverse(explode(' ', $fn))
|
||||||
|
|
||||||
|
|
||||||
|
// What we really want is
|
||||||
|
// 'N' => Adams;John;Quincy;Reverend,Dr.;III
|
||||||
|
// which is a very difficult parsing problem especially if you allow
|
||||||
|
// the surname to contain spaces. The only way to be sure to get it
|
||||||
|
// right is to provide a form to input all the various fields and not
|
||||||
|
// try to extract it from the FN.
|
||||||
|
|
||||||
if(! $vcard) {
|
if(! $vcard) {
|
||||||
$vcard = new \Sabre\VObject\Component\VCard([
|
$vcard = new \Sabre\VObject\Component\VCard([
|
||||||
'FN' => $fn,
|
'FN' => $fn,
|
||||||
|
@ -656,11 +656,24 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
|
|||||||
function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
|
function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
|
||||||
|
|
||||||
logger($msg, $level, $priority);
|
logger($msg, $level, $priority);
|
||||||
|
|
||||||
|
if(file_exists('btlogger.log') && is_writable('btlogger.log')) {
|
||||||
|
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||||
|
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
|
||||||
|
$s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
|
||||||
|
@file_put_contents('btlogger.log', $s, FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
|
||||||
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
if($stack) {
|
if($stack) {
|
||||||
for($x = 1; $x < count($stack); $x ++) {
|
for($x = 1; $x < count($stack); $x ++) {
|
||||||
logger('stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()',$level, $priority);
|
$s = 'stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()';
|
||||||
|
logger($s,$level, $priority);
|
||||||
|
|
||||||
|
if(file_exists('btlogger.log') && is_writable('btlogger.log')) {
|
||||||
|
@file_put_contents('btlogger.log', $s, FILE_APPEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user