From 32d09637c89d02acaf7d7621d5c64ee2f2a35f16 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Fri, 1 May 2020 09:57:24 +0200 Subject: [PATCH] Bugfix: error in check for compress file creation --- iwla.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/iwla.py b/iwla.py index e865a7f..6d04cc4 100755 --- a/iwla.py +++ b/iwla.py @@ -132,7 +132,7 @@ class IWLA(object): ANALYSIS_CLASS = 'HTTP' API_VERSION = 1 - IWLA_VERSION = '0.5-dev' + IWLA_VERSION = '0.6' def __init__(self, logLevel, dry_run): self.meta_infos = {} @@ -572,34 +572,33 @@ class IWLA(object): self.display.addPage(page) - def _compressFile(self, build_time, root, filename): + def _compressFile(self, root, filename): path = os.path.join(root, filename) gz_path = path + '.gz' self.logger.debug('Compress %s => %s' % (path, gz_path)) if not os.path.exists(gz_path) or\ - os.stat(path).st_mtime >= build_time: + os.stat(path).st_mtime > os.stat(gz_path).st_mtime: if self.dry_run: return with open(path, 'rb') as f_in, gzip.open(gz_path, 'wb') as f_out: f_out.write(f_in.read()) - def _compressFiles(self, build_time, root): + def _compressFiles(self, root): if not conf.compress_output_files: return for rootdir, subdirs, files in os.walk(root, followlinks=True): for f in files: for ext in conf.compress_output_files: if f.endswith(ext): - self._compressFile(build_time, rootdir, f) + self._compressFile(rootdir, f) break def _generateDisplay(self): self._generateDisplayDaysStats() self._callPlugins(conf.DISPLAY_HOOK_DIRECTORY) self._generateDisplayWholeMonthStats() - build_time = time.mktime(time.localtime()) self.display.build(conf.DISPLAY_ROOT) - self._compressFiles(build_time, conf.DISPLAY_ROOT) + self._compressFiles(conf.DISPLAY_ROOT) def _createEmptyStats(self): stats = {}