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:
authordiosmosis <diosmosis@users.noreply.github.com>2020-08-20 23:55:05 +0300
committerGitHub <noreply@github.com>2020-08-20 23:55:05 +0300
commit8dfe273a96f681d0f8c6d1491bdd206cbaf8c04b (patch)
treeea9326665bbd8f4733192cd772d76048c0513f5c /plugins/ExamplePlugin
parente08e8551f316e299b47eda5e3ce550ef3ff8265a (diff)
add convenience method for handling partial archiving in Archiver.php (#16326)
* convenience method * fixing build
Diffstat (limited to 'plugins/ExamplePlugin')
-rw-r--r--plugins/ExamplePlugin/Archiver.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/plugins/ExamplePlugin/Archiver.php b/plugins/ExamplePlugin/Archiver.php
index 13455ce6eb..89d79959b9 100644
--- a/plugins/ExamplePlugin/Archiver.php
+++ b/plugins/ExamplePlugin/Archiver.php
@@ -52,8 +52,8 @@ class Archiver extends \Piwik\Plugin\Archiver
{
parent::__construct($processor);
- $this->requestedReport = $processor->getParams()->getArchiveOnlyReport();
- if ($this->requestedReport) {
+ $requestedReport = $processor->getParams()->getArchiveOnlyReport();
+ if ($requestedReport) {
$processor->getParams()->setIsPartialArchive(true);
}
@@ -74,7 +74,7 @@ class Archiver extends \Piwik\Plugin\Archiver
* $this->getProcessor()->insertBlobRecord(self::EXAMPLEPLUGIN_ARCHIVE_RECORD, $visitorReport);
*/
- if ($this->isArchiving(self::EXAMPLEPLUGIN_METRIC_NAME)) {
+ if ($this->isRequestedReport(self::EXAMPLEPLUGIN_METRIC_NAME)) {
// insert a test numeric metric that is the difference in days between the day we're archiving and
// $this->daysFrom.
$daysFrom = Date::factory($this->daysFrom);
@@ -86,7 +86,7 @@ class Archiver extends \Piwik\Plugin\Archiver
$this->getProcessor()->insertNumericRecord(self::EXAMPLEPLUGIN_METRIC_NAME, $differenceInDays);
}
- if ($this->isArchiving(self::EXAMPLEPLUGIN_CONST_METRIC_NAME)) {
+ if ($this->isRequestedReport(self::EXAMPLEPLUGIN_CONST_METRIC_NAME)) {
$archiveCount = $this->incrementArchiveCount();
$archiveCount = 50 + $archiveCount;
$archiveCount += 5 - ($archiveCount % 5); // round up to nearest 5 multiple to avoid random test failures
@@ -106,10 +106,10 @@ class Archiver extends \Piwik\Plugin\Archiver
*/
$reports = [];
- if ($this->isArchiving(self::EXAMPLEPLUGIN_METRIC_NAME)) {
+ if ($this->isRequestedReport(self::EXAMPLEPLUGIN_METRIC_NAME)) {
$reports[] = self::EXAMPLEPLUGIN_METRIC_NAME;
}
- if ($this->isArchiving(self::EXAMPLEPLUGIN_CONST_METRIC_NAME)) {
+ if ($this->isRequestedReport(self::EXAMPLEPLUGIN_CONST_METRIC_NAME)) {
$reports[] = self::EXAMPLEPLUGIN_CONST_METRIC_NAME;
}
$this->getProcessor()->aggregateNumericMetrics($reports);
@@ -122,11 +122,6 @@ class Archiver extends \Piwik\Plugin\Archiver
return $result;
}
- private function isArchiving(string $reportName)
- {
- return empty($this->requestedReport) || $this->requestedReport == $reportName;
- }
-
private function createSequence()
{
$sequence = new Sequence('ExamplePlugin_archiveCount');