r2 - 11 Aug 2006 - 19:45:00 - PeterThoenyYou are here: TWiki >  Codev Web > ViewfileLogging
Tags:
, create new tag

File download statistics by logging viewfiles

To show statistics on the popularity of different file downloads, I first set up the Apache rewrite rule thing described in SecuringAttachments, then updated lib/TWiki/UI/View.pm as below to add log file entries everytime someone downloaded a file from /pub (except things like inline images which are handled in the rewrite rules so they don't turn into viewfiles).

If someone were feeling energetic, they could follow this up with updates to Statistics.pm to add similar stats on download popularity that are currently shown for view popularity.

For now, I'm just filtering the viewfile log entries with a shell script and then loading into an SQL database to run quick reports.

--- View.pm.orig   2006-06-25 10:34:46.000000000 -0700
+++ View.pm   2006-08-08 16:41:13.000000000 -0700
@@ -369,6 +369,10 @@
     my $fileContent = $session->{store}->readAttachment(
         $session->{user}, $webName, $topic, $fileName, $rev );
 
+    if( $TWiki::cfg{Log}{view} ) {
+        $session->writeLog( 'viewfile', $webName.'.'.$topic, $fileName );
+    }
+
     print $query->header(
         -type => _suffixToMimeType( $session, $fileName ),
         -Content_length => length( $fileContent ),

-- Contributors: AIanVogelesang - 11 Aug 2006

Discussion

Good point. Thank you for contributing this. I created Bugs:Item2756 to track the item.

I think we should add a new $cfg{Log}{viewfile} flag.

-- PeterThoeny - 11 Aug 2006

 
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo