From a7070cb793fae5597291a7908ce46cd53319b211 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 14 Nov 2009 18:52:25 +0100 Subject: [PATCH] script to create old historic static pages --- create-historic.php | 21 +++++++++++++++++++++ functions.php | 23 +++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 create-historic.php diff --git a/create-historic.php b/create-historic.php new file mode 100644 index 0000000..2977931 --- /dev/null +++ b/create-historic.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/functions.php b/functions.php index 7649f61..803d684 100644 --- a/functions.php +++ b/functions.php @@ -10,13 +10,32 @@ function aws_sites() return $sites; } -function aws_createHtml($site, $last = false) +function aws_historic($site) +{ + $dates = array(); + foreach (glob($GLOBALS['awdata'] . '/awstats*.' . $site . '.txt') as $file) { + $date = explode( + '-', + preg_replace( + '/^.*\/awstats([0-9]{2})([0-9]{4})\\.' . $site . '.txt$/', + '\\2-\\1', + $file + ) + ); + count($date) == 2 && $dates[] = $date; + } + return $dates; +} + +function aws_createHtml($site, $last = false, $year = null, $month = null) { if (!is_dir($GLOBALS['htmldir'])) { die("HTML directory " . $GLOBALS['htmldir'] . " does not exist\n"); } - if ($last) { + if ($year !== null && $month !== null) { + //already set + } else if ($last) { $month = date('m', strtotime('last month')); $year = date('Y', strtotime('last month')); } else { -- 2.30.2