Make backup before compressing (low memory servers)
Fix error : Call post hook plugins even in display only mode Don't compute unordered hits (remove pasts if they are found after current) Remove tags in stats diff Don't do geolocalisation is visitor is not valid Don't try to find search engine on robots Update robot check rules Add top_pages_diff plugin
This commit is contained in:
16
iwla.py
16
iwla.py
@@ -252,12 +252,18 @@ class IWLA(object):
|
||||
if not os.path.exists(base):
|
||||
os.makedirs(base)
|
||||
|
||||
# Make a backup in case of something fails
|
||||
if os.path.exists(filename):
|
||||
shutil.copy(filename, filename + '.bak')
|
||||
|
||||
with open(filename + '.tmp', 'wb+') as f, self._openDB(filename, 'w') as fzip:
|
||||
cPickle.dump(obj, f)
|
||||
os.fsync(f)
|
||||
f.seek(0)
|
||||
fzip.write(f.read())
|
||||
os.fsync(fzip)
|
||||
os.remove(filename + '.tmp')
|
||||
if os.path.exists(filename + '.bak'):
|
||||
os.remove(filename + '.bak')
|
||||
|
||||
def _deserialize(self, filename):
|
||||
if not os.path.exists(filename):
|
||||
@@ -626,15 +632,13 @@ class IWLA(object):
|
||||
|
||||
duplicated_stats['nb_visitors'] = stats['nb_visitors'] = len(self.valid_visitors.keys())
|
||||
|
||||
self._callPlugins(conf.POST_HOOK_DIRECTORY)
|
||||
|
||||
if args.display_only:
|
||||
self._generateDisplay()
|
||||
return
|
||||
|
||||
self._callPlugins(conf.POST_HOOK_DIRECTORY)
|
||||
|
||||
path = self.getDBFilename(cur_time)
|
||||
if os.path.exists(path) and not self.dry_run:
|
||||
os.remove(path)
|
||||
|
||||
self.logger.info("==> Serialize to %s" % (path))
|
||||
self._serialize(self.current_analysis, path)
|
||||
@@ -701,6 +705,8 @@ class IWLA(object):
|
||||
self.logger.debug("Not in time")
|
||||
return False
|
||||
self.analyse_started = True
|
||||
if t < cur_time: # Don't accept past hits
|
||||
return False
|
||||
if cur_time.tm_mon != t.tm_mon:
|
||||
self._generateDayStats()
|
||||
self._generateMonthStats()
|
||||
|
||||
Reference in New Issue
Block a user