From 39f8f8c0cf26daaa121c36f765fed337179b51fb Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Fri, 13 Nov 2015 16:07:17 -0500 Subject: [PATCH] Test case : Preparation : * Add the "filesaccess" preference to your "koha-conf.xml" file. This * preference should be in the "config" section. For this test cas, we * will use the "/tmp/files-access" directory : ... /tmp/files-access ... * Create the log directory on your server. Make sure this directory * is readable by your web server : $ mkdir /tmp/files-access * Add a test file in the log directory : $ cd /tmp/files-access $ echo "Hello world!" > test.txt Test : * Go in the "tools/Additional tools" section in the intranet and select "Report/log * files" * The "test.txt" should appear in the files list. * Click on the "test.txt" file, a download dialog should appear. * Download the file and verify its content. It should contain the * text "Hello world!". http://bugs.koha-community.org/show_bug.cgi?id=11317 --- .../prog/en/modules/reports/report_files.tt | 4 ++-- .../prog/en/modules/reports/reports-home.tt | 1 - .../prog/en/modules/tools/tools-home.tt | 3 +++ reports/report_files.pl | 13 ++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt index d17c2dd..416f98b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt @@ -31,8 +31,8 @@

Report/log files

-[% IF ( error_no_publicdir ) %] -
Error : Report/log files could not be found because the "publicdir" option was not set in "koha-conf.xml". Contact your system administrator to add this option.
+[% IF ( error_no_dir ) %] +
Error : Report/log files could not be found because the "filesaccess" option was not set in "koha-conf.xml". Contact your system administrator to add this option.
[% ELSE %] [% IF ( files_loop ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt index d74e25f..fde9ad3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt @@ -66,7 +66,6 @@
  • Koha database schema
  • Koha reports library
  • -
  • Report/log files
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index 7b2e14e..2b8c498 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -111,6 +111,9 @@
    Use tool plugins
    [% END %] +
    Report/log files
    +
    Report/log files
    +
    diff --git a/reports/report_files.pl b/reports/report_files.pl index 6a37396..2d30773 100755 --- a/reports/report_files.pl +++ b/reports/report_files.pl @@ -33,7 +33,7 @@ use Digest::MD5 qw(md5_hex); my $input = new CGI; my $file_id = $input->param("id"); -my $directory = C4::Context->config('publicdir'); +my $directory = C4::Context->config('filesaccess'); my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => "reports/report_files.tt", @@ -44,7 +44,7 @@ my ($template, $borrowernumber, $cookie) }); unless($directory) { - $template->param(error_no_publicdir => 1); + $template->param(error_no_dir => 1); } else { #Get the files list @@ -57,8 +57,15 @@ else { next if ($filename =~ /^\./ or -d $full_path); my $st = stat($full_path); + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime($st->mtime); + my $dt=DateTime->new(year => $year + 1900, + month => $mon + 1, + day => $mday, + hour => $hour, + minute => $min, + ); push(@files_list, {name => $filename, - date => scalar localtime($st->mtime), + date =>Koha::DateUtils::output_pref($dt), size => $st->size, id => $id}); } -- 1.7.9.5