blob: aac3b936da3c3f1970f8dc683eeb11417382d8ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik
* @package Piwik_PluginArchiver
*/
use Piwik\Config;
use Piwik\Common;
/**
* Plugins that archive metrics for websites can implement an Archiver that extends this class
*/
abstract class Piwik_PluginsArchiver
{
protected $processor;
public function __construct(Piwik_ArchiveProcessor $processing)
{
$this->maximumRows = Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];
$this->processor = $processing;
}
abstract public function archiveDay();
abstract public function archivePeriod();
// todo: review this concept, each plugin should somehow maintain the list of report names they generate
public function shouldArchive()
{
$pluginName = Common::unprefixClass(get_class($this));
$pluginName = str_replace("_Archiver", "", $pluginName);
return $this->getProcessor()->shouldProcessReportsForPlugin($pluginName);
}
/**
* @return Piwik_ArchiveProcessor_Day|Piwik_ArchiveProcessor_Period
*/
protected function getProcessor()
{
return $this->processor;
}
/**
* @return Piwik_DataAccess_LogAggregator
*/
protected function getLogAggregator()
{
return $this->getProcessor()->getLogAggregator();
}
}
|