Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/DataAccess/LogAggregator.php')
-rw-r--r--core/DataAccess/LogAggregator.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index 4651394556..c30132f41e 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -10,10 +10,14 @@ namespace Piwik\DataAccess;
use Piwik\ArchiveProcessor\Parameters;
use Piwik\Common;
+use Piwik\Container\StaticContainer;
use Piwik\DataArray;
+use Piwik\Date;
use Piwik\Db;
use Piwik\Metrics;
+use Piwik\Period;
use Piwik\Tracker\GoalManager;
+use Psr\Log\LoggerInterface;
/**
* Contains methods that calculate metrics by aggregating log data (visits, actions, conversions,
@@ -141,16 +145,23 @@ class LogAggregator
private $queryOriginHint = '';
/**
+ * @var LoggerInterface
+ */
+ private $logger;
+
+
+ /**
* Constructor.
*
* @param \Piwik\ArchiveProcessor\Parameters $params
*/
- public function __construct(Parameters $params)
+ public function __construct(Parameters $params, LoggerInterface $logger = null)
{
- $this->dateStart = $params->getDateStart();
- $this->dateEnd = $params->getDateEnd();
+ $this->dateStart = $params->getDateTimeStart();
+ $this->dateEnd = $params->getDateTimeEnd();
$this->segment = $params->getSegment();
$this->sites = $params->getIdSites();
+ $this->logger = $logger ?: StaticContainer::get('Psr\Log\LoggerInterface');
}
public function setQueryOriginHint($nameOfOrigiin)
@@ -169,6 +180,9 @@ class LogAggregator
$query['sql'] = 'SELECT /* ' . $this->queryOriginHint . ' */' . substr($query['sql'], strlen($select));
}
+ // Uncomment to log on DEBUG level all archiving queries
+ // $this->logger->debug($query['sql']);
+
return $query;
}
@@ -503,7 +517,7 @@ class LogAggregator
*/
protected function getGeneralQueryBindParams()
{
- $bind = array($this->dateStart->getDateStartUTC(), $this->dateEnd->getDateEndUTC());
+ $bind = array($this->dateStart->toString(Date::DATE_TIME_FORMAT), $this->dateEnd->toString(Date::DATE_TIME_FORMAT));
$bind = array_merge($bind, $this->sites);
return $bind;