View Issue Details

IDProjectCategoryView StatusLast Update
0011965mantisbtattachmentspublic2014-09-23 18:06
Reportercas Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.2.1 
Summary0011965: File download counter
Description

We wanted to know how many times a file (attached to a bug) was downloaded.
Sfter some analysis it appears to be a very simple adjustment.

Steps To Reproduce

Add field 'downloaded' (int 10 default 0) to mantis_bug_file_table
bug_api.php, function bug_get_attachments, add field downloaded
file_api, function file_get_visible _attachments add the lines :
$t_downloaded = $t_row['downloaded'];
$t_attachment['downloaded'] = $t_downloaded;
just before 'if( $t_can_download ) {'
file_download.php, add the following lines:

Update download counter

$query2 = "update $t_bug_file_table set downloaded=downloaded+1 WHERE id=" . $v_id;
$result2 = db_query_bound( $query2 );
just after (line 75):
if ( !file_can_download_bug_attachments( $v_bug_id ) ) {access_denied();}
Last change in print-api.php, function print bug_attachment_list. add the line:
$t_downloaded = $t_attachment['downloaded'] ;
just after "$t_date_added="
Finally change the actual line that prints the attachment with:
echo $t_href_end . ' ' . $t_href_start . $t_file_display_name . $t_href_end . $t_href_clicket . ' (' . $t_filesize . ' ' . lang_get( 'bytes' ) . ') ' . '<span class=\"italic\">' . $t_date_added . ' Downloaded: '. $t_downloaded . ' time(s)</span>';

Tagspatch
Attached Files
ScreenShot001.png (12,906 bytes)   
ScreenShot001.png (12,906 bytes)   

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0007060 closedatrol Add a downloads counter for attachment 

Activities

atrol

atrol

2012-03-14 17:39

developer   ~0031459

Reopened, the issue is not fixed in master-1.2.x or master branch at the official repository.

grangeway

grangeway

2012-10-20 20:00

reporter   ~0033295

this is fixed in the mantis-2.x branch

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036217

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch