From 7c4ad5b54006acc27b6dc22d3d746d15a2d14520 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 7 Jan 2016 17:56:14 +0100 Subject: rely on $GLOBALS["debug_time"] --- it.class | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/it.class b/it.class index 3c9c46c..6840eaa 100644 --- a/it.class +++ b/it.class @@ -70,16 +70,14 @@ static function &cloneobj(&$object) /** * Append all arguments to a logfile (tab separated). Date will be added to filename and line * @param $name Name of logfile. Will be in log/ of service unless it starts with / - * @param $args... Varargs to log, will be tab separated. datetime => ... can be in first arg (dangerous) + * @param $args... Varargs to log, will be tab separated. */ static function log($name /* ... */) { $args = func_get_args(); - $name = array_shift($args); - $timestamp = is_array($args[0]) && ($p = array_shift($args)) && $p['datetime'] ? strtotime($p['datetime']) : time(); - $line = date("Y-m-d H:i:s", $timestamp) . "\t" . implode("\t", $args) . "\n"; + $line = it::date("Y-m-d H:i:s") . "\t" . implode("\t", array_slice($args, 1)) . "\n"; $basefn = substr($name, 0, 1) == "/" ? $name : $GLOBALS['ULTRAHOME'] . "/log/$name"; - $fullfn = $basefn . "-" . date('Ymd', $timestamp); + $fullfn = $basefn . "-" . it::date('Ymd'); if (substr($fullfn, 0, 1) == "/") { @@ -91,7 +89,7 @@ static function log($name /* ... */) @chmod("$fullfn.$tmp", 0664); @rename("$fullfn.$tmp", $fullfn); @unlink($basefn); - if (@readlink($basefn) < basename($fullfn)) + if (@readlink($basefn) < basename($fullfn)) # may be older due to $GLOBALS['debug_time'] @symlink($fullfn, $basefn); } -- cgit v1.2.3