Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/statsmaster/templates/build_static_head.erb

Issue 29464559: #1538 - Remove class statsmaster and associated resources (Closed)
Patch Set: Created June 13, 2017, 9:43 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/statsmaster/templates/build_static_head.erb
diff --git a/modules/statsmaster/templates/build_static_head.erb b/modules/statsmaster/templates/build_static_head.erb
deleted file mode 100644
index 37dfb5068d759a54e58d9c7ab01b2966f8d0f2d0..0000000000000000000000000000000000000000
--- a/modules/statsmaster/templates/build_static_head.erb
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess
-import sys
-import os
-import re
-from datetime import datetime, timedelta
-
-if len(sys.argv) > 1:
- yearmonth = sys.argv[1]
- if yearmonth == 'prevmonth':
- now = datetime.now()
- yearmonth = (now - timedelta(days=now.day)).strftime('%Y%m')
- year, month = re.search(r'^(\d{4})(\d{2})$', yearmonth).groups()
- dirtemplate = os.path.join('/var/www/awstats/archive/%s', yearmonth)
- additional_params = ['-month=%s' % month, '-year=%s' % year]
- day = None
-else:
- dirtemplate = '/var/www/awstats/%s'
- additional_params = []
-
- yesterday = datetime.now() - timedelta(days=1)
- day = yesterday.strftime('%Y%m%d')
- daily_params = ['-day=%i' % yesterday.day,
- '-month=%i' % yesterday.month,
- '-year=%i' % yesterday.year]
-
-def build_pages(site, dir, databasebreak):
- if not os.path.exists(dir):
- os.mkdir(dir, 0755)
-
- datadir = {
- 'month': '/var/www/awstatsdata',
- 'day': '/var/www/awstatsdatadaily',
- }[databasebreak]
-
- additional = daily_params if databasebreak == 'day' else additional_params
-
- subprocess.check_output([
- '/usr/share/awstats/tools/awstats_buildstaticpages.pl',
- '-configdir=/var/www/awstatsconf',
- '-config=%s' % site,
- '-databasebreak=%s' % databasebreak,
- '-dir=%s' % dir
- ] + additional, env={'AWSTATSDATA': datadir})
-
- index = os.path.join(dir, 'index.html')
- if not os.path.exists(index):
- os.symlink(os.path.join(dir, 'awstats.%s.html' % site), index)

Powered by Google App Engine
This is Rietveld