blob: dd49ba37e7c2a1218348b17d4530aa9feef8a461 (
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
56
57
58
59
|
<?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
*/
namespace Piwik;
use Piwik\Config;
use Piwik\Common;
use Piwik\ArchiveProcessor;
use Piwik\ArchiveProcessor\Day;
use Piwik\DataAccess\LogAggregator;
/**
* Plugins that archive metrics for websites can implement an Archiver that extends this class
*/
abstract class PluginsArchiver
{
protected $processor;
public function __construct(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 Day|Period
*/
protected function getProcessor()
{
return $this->processor;
}
/**
* @return \Piwik\DataAccess\LogAggregator
*/
protected function getLogAggregator()
{
return $this->getProcessor()->getLogAggregator();
}
}
|