diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-07-01 10:21:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-01 10:21:41 +0300 |
commit | c6bb7314071c18cf0ef54a4e35d3531314e68792 (patch) | |
tree | 8bc6290c4335fdb2088398d99bab072177f0c0b6 /plugins/Ecommerce | |
parent | 680ffd796ea93e1b5e7699d126c7c5262ed0e851 (diff) |
Removes CustomVariables plugin from core (#16090)
* Removes CustomVariables plugin
* removes CustomVariables plugin from core list
* Move methods to get custom variables from request to the plugin
* define visit fields to persist in plugin
* do not use custom variables plugin if not available
* adjust test requirements for CustomVariables plugin
* Only execute update if plugin is installed
* do not consider custom variables widget as api in tests
* move autosuggest tests for custom variables to plugin
* do not use custom variable segments in core tests
* move multi column segment test to custom variables plugin
* do not use custom variable segment in archive cron test
* update access log to use new product view parameters instead of custom variables
* move some custom variables based tests to plugin
* Use Contents API instead of CustomVariables for CSV export tests
* skip some tests if CustomVariables plugin is not available
* Adjust tracker code generator tests to work without custom variables plugin
* [TEMP] remove custom variables from system test output
* adjust some tests to run without custom variables plugin
* apply some review feedback
* Readds Custom Variables as submodule (#16104)
* Adds CustomVariables as submodule
* Revert "[TEMP] remove custom variables from system test output"
This reverts commit 30b56dc135b6c130c841306f739dbcd7d9f4a366.
* use submodule branch
* test changes due to loading CustomVariables as submodule (plugin order)
* updates some expected screenshots
* improve test fixture
* submodule update
Diffstat (limited to 'plugins/Ecommerce')
6 files changed, 95 insertions, 79 deletions
diff --git a/plugins/Ecommerce/Columns/ProductViewCategory.php b/plugins/Ecommerce/Columns/ProductViewCategory.php index 0488c6c3a2..e7b773e828 100644 --- a/plugins/Ecommerce/Columns/ProductViewCategory.php +++ b/plugins/Ecommerce/Columns/ProductViewCategory.php @@ -16,7 +16,9 @@ use Piwik\Db; use Piwik\Log; use Piwik\Piwik; use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugin\Manager; use Piwik\Plugin\Segment; +use Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor; use Piwik\Segment\SegmentsList; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -110,11 +112,13 @@ class ProductViewCategory extends ActionDimension } // fall back to custom variables (might happen if old logs are replayed) - $customVariables = $request->getCustomVariablesInPageScope(); - if (isset($customVariables['custom_var_k5']) && $customVariables['custom_var_k5'] === '_pkc') { - $categories = $this->handleCategoryParam($customVariables['custom_var_v5'] ?? ''); + if (Manager::getInstance()->isPluginActivated('CustomVariables')) { + $customVariables = CustomVariablesRequestProcessor::getCustomVariablesInPageScope($request); + if (isset($customVariables['custom_var_k5']) && $customVariables['custom_var_k5'] === '_pkc') { + $categories = $this->handleCategoryParam($customVariables['custom_var_v5'] ?? ''); - return $categories[$this->categoryNumber - 1] ?? false; + return $categories[$this->categoryNumber - 1] ?? false; + } } return parent::onLookupAction($request, $action); diff --git a/plugins/Ecommerce/Columns/ProductViewName.php b/plugins/Ecommerce/Columns/ProductViewName.php index 687a3cd52b..63462d724b 100644 --- a/plugins/Ecommerce/Columns/ProductViewName.php +++ b/plugins/Ecommerce/Columns/ProductViewName.php @@ -12,6 +12,8 @@ use Piwik\Columns\Discriminator; use Piwik\Columns\Join\ActionNameJoin; use Piwik\Common; use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugin\Manager; +use Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -42,9 +44,11 @@ class ProductViewName extends ActionDimension } // fall back to custom variables (might happen if old logs are replayed) - $customVariables = $request->getCustomVariablesInPageScope(); - if (isset($customVariables['custom_var_k4']) && $customVariables['custom_var_k4'] === '_pkn') { - return $customVariables['custom_var_v4'] ?? false; + if (Manager::getInstance()->isPluginActivated('CustomVariables')) { + $customVariables = CustomVariablesRequestProcessor::getCustomVariablesInPageScope($request); + if (isset($customVariables['custom_var_k4']) && $customVariables['custom_var_k4'] === '_pkn') { + return $customVariables['custom_var_v4'] ?? false; + } } return parent::onLookupAction($request, $action); diff --git a/plugins/Ecommerce/Columns/ProductViewPrice.php b/plugins/Ecommerce/Columns/ProductViewPrice.php index 2b8b96fbb6..d4a290e4c8 100644 --- a/plugins/Ecommerce/Columns/ProductViewPrice.php +++ b/plugins/Ecommerce/Columns/ProductViewPrice.php @@ -9,6 +9,8 @@ namespace Piwik\Plugins\Ecommerce\Columns; use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugin\Manager; +use Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor; use Piwik\Tracker\Action; use Piwik\Tracker\Request; use Piwik\Tracker\Visitor; @@ -30,9 +32,11 @@ class ProductViewPrice extends ActionDimension } // fall back to custom variables (might happen if old logs are replayed) - $customVariables = $request->getCustomVariablesInPageScope(); - if (isset($customVariables['custom_var_k2']) && $customVariables['custom_var_k2'] === '_pkp') { - return $customVariables['custom_var_v2'] ?? false; + if (Manager::getInstance()->isPluginActivated('CustomVariables')) { + $customVariables = CustomVariablesRequestProcessor::getCustomVariablesInPageScope($request); + if (isset($customVariables['custom_var_k2']) && $customVariables['custom_var_k2'] === '_pkp') { + return $customVariables['custom_var_v2'] ?? false; + } } return parent::onNewAction($request, $visitor, $action); diff --git a/plugins/Ecommerce/Columns/ProductViewSku.php b/plugins/Ecommerce/Columns/ProductViewSku.php index 140f125801..dab50f1094 100644 --- a/plugins/Ecommerce/Columns/ProductViewSku.php +++ b/plugins/Ecommerce/Columns/ProductViewSku.php @@ -12,6 +12,8 @@ use Piwik\Columns\Discriminator; use Piwik\Columns\Join\ActionNameJoin; use Piwik\Common; use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugin\Manager; +use Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor; use Piwik\Tracker\Action; use Piwik\Tracker\Request; @@ -42,9 +44,11 @@ class ProductViewSku extends ActionDimension } // fall back to custom variables (might happen if old logs are replayed) - $customVariables = $request->getCustomVariablesInPageScope(); - if (isset($customVariables['custom_var_k3']) && $customVariables['custom_var_k3'] === '_pks') { - return $customVariables['custom_var_v3'] ?? false; + if (Manager::getInstance()->isPluginActivated('CustomVariables')) { + $customVariables = CustomVariablesRequestProcessor::getCustomVariablesInPageScope($request); + if (isset($customVariables['custom_var_k3']) && $customVariables['custom_var_k3'] === '_pks') { + return $customVariables['custom_var_v3'] ?? false; + } } return parent::onLookupAction($request, $action); diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_LiveEcommerceStatusOrdered__Live.getLastVisitsDetails_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_LiveEcommerceStatusOrdered__Live.getLastVisitsDetails_day.xml index e9297adce2..178974494a 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_LiveEcommerceStatusOrdered__Live.getLastVisitsDetails_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_LiveEcommerceStatusOrdered__Live.getLastVisitsDetails_day.xml @@ -137,20 +137,6 @@ <visitLocalHour>12</visitLocalHour> <daysSinceLastVisit>0</daysSinceLastVisit> <secondsSinceLastVisit>15480</secondsSinceLastVisit> - <customVariables> - <row> - <customVariableName3>VisitorName</customVariableName3> - <customVariableValue3>Great name!</customVariableValue3> - </row> - <row> - <customVariableName4>ValueIsZero</customVariableName4> - <customVariableValue4>0</customVariableValue4> - </row> - <row> - <customVariableName5>VisitorType</customVariableName5> - <customVariableValue5>NewLoggedOut</customVariableValue5> - </row> - </customVariables> <resolution>1024x768</resolution> <plugins>cookie, flash, java</plugins> <pluginsIcons> @@ -167,6 +153,20 @@ <pluginName>java</pluginName> </row> </pluginsIcons> + <customVariables> + <row> + <customVariableName3>VisitorName</customVariableName3> + <customVariableValue3>Great name!</customVariableValue3> + </row> + <row> + <customVariableName4>ValueIsZero</customVariableName4> + <customVariableValue4>0</customVariableValue4> + </row> + <row> + <customVariableName5>VisitorType</customVariableName5> + <customVariableValue5>NewLoggedOut</customVariableValue5> + </row> + </customVariables> </row> <row> <idSite>1</idSite> @@ -370,20 +370,6 @@ <visitLocalHour>12</visitLocalHour> <daysSinceLastVisit>0</daysSinceLastVisit> <secondsSinceLastVisit>68040</secondsSinceLastVisit> - <customVariables> - <row> - <customVariableName3>VisitorName</customVariableName3> - <customVariableValue3>Great name!</customVariableValue3> - </row> - <row> - <customVariableName4>ValueIsZero</customVariableName4> - <customVariableValue4>0</customVariableValue4> - </row> - <row> - <customVariableName5>VisitorType</customVariableName5> - <customVariableValue5>NewLoggedOut</customVariableValue5> - </row> - </customVariables> <resolution>1024x768</resolution> <plugins>cookie, flash, java</plugins> <pluginsIcons> @@ -400,5 +386,19 @@ <pluginName>java</pluginName> </row> </pluginsIcons> + <customVariables> + <row> + <customVariableName3>VisitorName</customVariableName3> + <customVariableValue3>Great name!</customVariableValue3> + </row> + <row> + <customVariableName4>ValueIsZero</customVariableName4> + <customVariableValue4>0</customVariableValue4> + </row> + <row> + <customVariableName5>VisitorType</customVariableName5> + <customVariableValue5>NewLoggedOut</customVariableValue5> + </row> + </customVariables> </row> </result>
\ No newline at end of file diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__Live.getLastVisitsDetails_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__Live.getLastVisitsDetails_day.xml index bfb26b5933..9751f50a76 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__Live.getLastVisitsDetails_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__Live.getLastVisitsDetails_day.xml @@ -202,20 +202,6 @@ <visitLocalHour>12</visitLocalHour> <daysSinceLastVisit>0</daysSinceLastVisit> <secondsSinceLastVisit>21240</secondsSinceLastVisit> - <customVariables> - <row> - <customVariableName3>VisitorName</customVariableName3> - <customVariableValue3>Great name!</customVariableValue3> - </row> - <row> - <customVariableName4>ValueIsZero</customVariableName4> - <customVariableValue4>0</customVariableValue4> - </row> - <row> - <customVariableName5>VisitorType</customVariableName5> - <customVariableValue5>NewLoggedOut</customVariableValue5> - </row> - </customVariables> <resolution>1024x768</resolution> <plugins>cookie, flash, java</plugins> <pluginsIcons> @@ -232,6 +218,20 @@ <pluginName>java</pluginName> </row> </pluginsIcons> + <customVariables> + <row> + <customVariableName3>VisitorName</customVariableName3> + <customVariableValue3>Great name!</customVariableValue3> + </row> + <row> + <customVariableName4>ValueIsZero</customVariableName4> + <customVariableValue4>0</customVariableValue4> + </row> + <row> + <customVariableName5>VisitorType</customVariableName5> + <customVariableValue5>NewLoggedOut</customVariableValue5> + </row> + </customVariables> </row> <row> <idSite>1</idSite> @@ -584,20 +584,6 @@ <visitLocalHour>12</visitLocalHour> <daysSinceLastVisit>0</daysSinceLastVisit> <secondsSinceLastVisit>5760</secondsSinceLastVisit> - <customVariables> - <row> - <customVariableName3>VisitorName</customVariableName3> - <customVariableValue3>Great name!</customVariableValue3> - </row> - <row> - <customVariableName4>ValueIsZero</customVariableName4> - <customVariableValue4>0</customVariableValue4> - </row> - <row> - <customVariableName5>VisitorType</customVariableName5> - <customVariableValue5>NewLoggedOut</customVariableValue5> - </row> - </customVariables> <resolution>1024x768</resolution> <plugins>cookie, flash, java</plugins> <pluginsIcons> @@ -614,6 +600,20 @@ <pluginName>java</pluginName> </row> </pluginsIcons> + <customVariables> + <row> + <customVariableName3>VisitorName</customVariableName3> + <customVariableValue3>Great name!</customVariableValue3> + </row> + <row> + <customVariableName4>ValueIsZero</customVariableName4> + <customVariableValue4>0</customVariableValue4> + </row> + <row> + <customVariableName5>VisitorType</customVariableName5> + <customVariableValue5>NewLoggedOut</customVariableValue5> + </row> + </customVariables> </row> <row> <idSite>1</idSite> @@ -817,16 +817,6 @@ <visitLocalHour>12</visitLocalHour> <daysSinceLastVisit>0</daysSinceLastVisit> <secondsSinceLastVisit>0</secondsSinceLastVisit> - <customVariables> - <row> - <customVariableName4>ValueIsZero</customVariableName4> - <customVariableValue4>0</customVariableValue4> - </row> - <row> - <customVariableName5>VisitorType</customVariableName5> - <customVariableValue5>NewLoggedOut</customVariableValue5> - </row> - </customVariables> <resolution>1024x768</resolution> <plugins>cookie, flash, java</plugins> <pluginsIcons> @@ -843,5 +833,15 @@ <pluginName>java</pluginName> </row> </pluginsIcons> + <customVariables> + <row> + <customVariableName4>ValueIsZero</customVariableName4> + <customVariableValue4>0</customVariableValue4> + </row> + <row> + <customVariableName5>VisitorType</customVariableName5> + <customVariableValue5>NewLoggedOut</customVariableValue5> + </row> + </customVariables> </row> </result>
\ No newline at end of file |