From 130ccd476bd73bedd76f3f4a6a07268b5d2b695e Mon Sep 17 00:00:00 2001 From: hkosaka Date: Thu, 21 Jun 2012 09:43:26 +0000 Subject: [PATCH] 2012-06-21 Hirofumi Kosaka * extensions/pandora_logs.php: show the last 500k bytes instead error message, if the file is too large. Merged from 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6644 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ pandora_console/extensions/pandora_logs.php | 24 +++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7bc0911f36..5d8affe211 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-06-21 Hirofumi Kosaka + + * extensions/pandora_logs.php: show the last 500k bytes + instead error message, if the file is too large. + Merged from 4.0.2 + 2012-06-21 Hirofumi Kosaka * extensions/net_tools.php: Use 'whereis' to get command path diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 85b8bf779c..b4dc447c7c 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -22,12 +22,18 @@ function view_logfile ($file_name) { echo ")"; } else { - if (filesize ($file_name) > 512000) { - echo "

".__("File is too large (> 500KB)"). "(".$file_name; - echo ")

"; + $file_size = filesize($file_name); + if ($file_size > 512000) { + $data = file_get_contents ($file_name, false, NULL, $file_size - 512000); + echo "

$file_name (".__("File is too large (> 500KB)").")

"; + + echo "

"; } else { - $data = file_get_contents ($file_name); + $data = file_get_contents ($file_name); echo "

$file_name (".format_numeric(filesize ($file_name)/1024)." KB)

"; echo "