diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-04-22 02:33:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 02:33:20 +0300 |
commit | 6d726c8005d6dd537ca7112b22d12ad70156af74 (patch) | |
tree | deb4e7c06a3671954567b5a1bb0d59edc45304ef /plugins | |
parent | b66635e4e16f5af26171211b6196f1dff319e1c5 (diff) |
Use full segment data to rearchive segment (#17478)
* Use full segment data to rearchive segment
* fix test
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SegmentEditor/API.php | 6 | ||||
-rw-r--r-- | plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index 2a732a995b..68a0a87db8 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -280,7 +280,8 @@ class API extends \Piwik\Plugin\API $segmentDefinitionChanged = $segment['definition'] !== $definition; if ($segmentDefinitionChanged && $autoArchive && !Rules::isBrowserTriggerEnabled()) { - $this->segmentArchiving->reArchiveSegment($bind); + $updatedSegment = $this->getModel()->getSegment($idSegment); + $this->segmentArchiving->reArchiveSegment($updatedSegment); } Cache::getEagerCache()->flushAll(); @@ -327,7 +328,8 @@ class API extends \Piwik\Plugin\API && !Rules::isBrowserTriggerEnabled() && $this->processNewSegmentsFrom != SegmentArchiving::CREATION_TIME ) { - $this->segmentArchiving->reArchiveSegment($bind); + $addedSegment = $this->getModel()->getSegment($id); + $this->segmentArchiving->reArchiveSegment($addedSegment); } return $id; diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php index 09430ca9be..a8a2c5208d 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php @@ -165,7 +165,7 @@ class SegmentEditorTest extends IntegrationTestCase ); $this->assertReArchivesQueued([ - ['idSites' => [1], 'pluginName' => null, 'report' => null, 'segment' => $updatedSegment['definition'], 'startDate' => null], + ['idSites' => [1], 'pluginName' => null, 'report' => null, 'segment' => $updatedSegment['definition'], 'startDate' => Date::factory('2013-01-01 00:00:00')->getTimestamp()], ]); $newSegment = API::getInstance()->get($idSegment2); |