diff options
-rw-r--r-- | it.class | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -76,9 +76,7 @@ static function log($name /* ... */) { $args = func_get_args(); $name = array_shift($args); - if (is_array($args[0])) - $p = array_shift($args); - $timestamp = $p['datetime'] ? strtotime($p['datetime']) : time(); + $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"; $basefn = substr($name, 0, 1) == "/" ? $name : $GLOBALS['ULTRAHOME'] . "/log/$name"; $fullfn = $basefn . "-" . date('Ymd', $timestamp); @@ -93,7 +91,8 @@ static function log($name /* ... */) @chmod("$fullfn.$tmp", 0664); @rename("$fullfn.$tmp", $fullfn); @unlink($basefn); - @symlink($fullfn, $basefn); + if (@readlink($basefn) < basename($fullfn)) + @symlink($fullfn, $basefn); } file_put_contents($fullfn, $line, FILE_APPEND); |