diff options
author | Friendika <info@friendika.com> | 2011-06-16 22:20:12 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-06-16 22:20:12 -0700 |
commit | fb0b22fb130c03cd92d361e044949c404c78b102 (patch) | |
tree | e18bf31cf4a7fe2dafcceca24e81b5956a9ffd48 /mod | |
parent | a66083b3e47cb6689728e38a0b7ade9d23ddbc4b (diff) | |
download | volse-hubzilla-fb0b22fb130c03cd92d361e044949c404c78b102.tar.gz volse-hubzilla-fb0b22fb130c03cd92d361e044949c404c78b102.tar.bz2 volse-hubzilla-fb0b22fb130c03cd92d361e044949c404c78b102.zip |
fix admin log viewer (will only read the last 5M of the log, and puts the text into a scrolling div)
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mod/admin.php b/mod/admin.php index 6f411bdb1..e657c8053 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -573,11 +573,32 @@ function admin_page_logs(&$a){ ); $t = get_markup_template("admin_logs.tpl"); + + $f = get_config('system','logfile'); + $size = filesize($f); + if($size > 5000000) + $size = 5000000; + + $data = ''; + $fp = fopen($f,'r'); + if($fp) { + $seek = fseek($fp,0-$size,SEEK_END); + if($seek === 0) { + fgets($fp); // throw away the first partial line + $data = str_replace(array("\n","\t"),array('<br />',' '),escape_tags(fread($fp,$size))); + while(! feof($fp)) + $data .= str_replace(array("\n","\t"),array('<br />',' '),escape_tags(fread($fp,4096))); + } + fclose($fp); + } + + return replace_macros($t, array( '$title' => t('Administration'), '$page' => t('Logs'), '$submit' => t('Submit'), '$clear' => t('Clear'), + '$data' => $data, '$baseurl' => $a->get_baseurl(), '$logname' => get_config('system','logfile'), |