From 00f5a744883fc3a5ce0706714d98fd9b86a7f51e Mon Sep 17 00:00:00 2001 From: matthieu_ Date: Fri, 17 Aug 2007 18:08:14 +0000 Subject: Implemented half of the PERIOD archiving still have to implement the DataTable::addDataTable( ) for recursive table --- modules/LogStats/Generator.php | 18 +++++++++++++++--- modules/LogStats/Visit.php | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'modules/LogStats') diff --git a/modules/LogStats/Generator.php b/modules/LogStats/Generator.php index c540ac530a..e2ffb7e175 100644 --- a/modules/LogStats/Generator.php +++ b/modules/LogStats/Generator.php @@ -32,6 +32,7 @@ class Piwik_LogStats_Generator public $reinitProfilingAtEveryRequest = true; public $host = 'http://localhost'; + protected $timestampToUse; public function __construct() { @@ -48,6 +49,16 @@ class Piwik_LogStats_Generator $this->profiling = true; Piwik_LogStats_Db::enableProfiling(); + $this->timestampToUse = time(); + } + + public function setTimestampToUse($timestamp) + { + $this->timestampToUse = $timestamp; + } + public function getTimestampToUse() + { + return $this->timestampToUse; } public function addParam( $name, $aValue) { @@ -182,6 +193,8 @@ class Piwik_LogStats_Generator // print("$i "); $nbActions = mt_rand(1, $nbActionsMaxPerVisit); + Piwik_LogStats_Generator_Visit::setTimestampToUse($this->getTimestampToUse()); + $this->generateNewVisit(); for($j = 1; $j <= $nbActions; $j++) { @@ -308,7 +321,7 @@ class Piwik_LogStats_Generator $len = mt_rand($minLength, $maxLength); // Register the lower case alphabet array - $alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'); + $alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g'); // Register the upper case alphabet array $ALPHA = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', @@ -427,8 +440,7 @@ class Piwik_LogStats_Generator_Visit extends Piwik_LogStats_Visit } protected function getCurrentDate( $format = "Y-m-d") { - if($format == "Y-m-d") return date($format); - else return date($format, $this->getCurrentTimestamp() ); + return date($format, $this->getCurrentTimestamp() ); } protected function getCurrentTimestamp() diff --git a/modules/LogStats/Visit.php b/modules/LogStats/Visit.php index 2b801ebb82..d42faee6d4 100644 --- a/modules/LogStats/Visit.php +++ b/modules/LogStats/Visit.php @@ -398,8 +398,9 @@ class Piwik_LogStats_Visit $localTime = Piwik_Common::getRequestVar( 'h', $this->getCurrentDate("H"), 'numeric') .':'. Piwik_Common::getRequestVar( 'm', $this->getCurrentDate("i"), 'numeric') .':'. Piwik_Common::getRequestVar( 's', $this->getCurrentDate("s"), 'numeric'); - $serverDate = $this->getCurrentDate(); - $serverTime = $this->getCurrentTimestamp(); + + $serverTime = $this->getCurrentTimestamp(); + $serverDate = $this->getCurrentDate(); if($this->isVisitorKnown()) { -- cgit v1.2.3