From: Frédéric Marchal Date: Mon, 29 Nov 2010 20:22:24 +0000 (+0000) Subject: Delete unused files from the directory containing the user report X-Git-Tag: v2.3.2~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=644f08d711e9c959d21a5c480c5e2a6f28100775;p=thirdparty%2Fsarg.git Delete unused files from the directory containing the user report When the user_report_limit is set and the site_user_time_date report is requested, the supernumerary time files were not deleted. They were wasting a lot of disk space. Now, only the time files that are linked to the user report are kept. Thanks to alf-man. --- diff --git a/ChangeLog b/ChangeLog index f7c8c78..e8d418e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,11 @@ SARG ChangeLog -Nov-28-2010 Version 2.3.2-pre1 +Nov-29-2010 Version 2.3.2-pre1 - Add support for sorttable.js (http://www.kryogenix.org/code/browser/sorttable/) to dynamically sort some tables (thanks to Éric). - Add the two command line options --lastlog and --keeplogs to set the number of reports to keep or to keep all the reports respectively (thanks to Emmanuel Lacour for the suggestion). - Report the user ID in the e-mail report. - Add an option to sort the top sites by time. + - Delete unused files from the directory containing the user report (thanks to alf-man). Sep-18-2010 Version 2.3.1 - Remove the distinct printf for the alpha architecture as it doesn't work anymore and is not necessary anyway. diff --git a/html.c b/html.c index 6f6e5ee..bc41751 100644 --- a/html.c +++ b/html.c @@ -371,6 +371,12 @@ void htmlrel(void) fputs("\n",fp_ou); count++; + } else if ((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0) { + url_to_file(url,siteind,sizeof(siteind)); + snprintf(tmp2,sizeof(tmp2),"%s/%s/tt%s-%s.html",outdirname,uinfo->filename,uinfo->filename,siteind); + if (unlink(tmp2)!=0) { + debuga(_("Cannot delete unused file \"%s\" - %s\n"),tmp2,strerror(errno)); + } } if(iprel) {