]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Delete unused files from the directory containing the user report
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 29 Nov 2010 20:22:24 +0000 (20:22 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 29 Nov 2010 20:22:24 +0000 (20:22 +0000)
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.

ChangeLog
html.c

index f7c8c78317305f9ef6fb295eccd54a9f11376e1e..e8d418ef53f4827a4aa085466669be93cf071a94 100644 (file)
--- 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 6f6e5ee0defa6c188cbde6d16de2c6f60cac6a91..bc4175189b57ce8054fd8c0da590c14d707e520d 100644 (file)
--- a/html.c
+++ b/html.c
@@ -371,6 +371,12 @@ void htmlrel(void)
 
             fputs("</tr>\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) {