diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-12-21 22:34:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 22:34:40 +0300 |
commit | cfa45b782eab7b161e228b43499102fb8c698d0d (patch) | |
tree | bcaa2bb2592a0eaaf63a09e6d95255ea352300cb /core | |
parent | 33c5391a79a7ac9572fdf822662a6f67f4ee962d (diff) |
Ensure removed dimensions are not used even if they still exist (#16934)
Diffstat (limited to 'core')
-rw-r--r-- | core/Columns/Dimension.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/Columns/Dimension.php b/core/Columns/Dimension.php index 35f725e6bc..fd5c50860b 100644 --- a/core/Columns/Dimension.php +++ b/core/Columns/Dimension.php @@ -757,15 +757,33 @@ abstract class Dimension { $columns = $plugin->findMultipleComponents('Columns', '\\Piwik\\Columns\\Dimension'); $instances = array(); + $removedDimensions = self::getRemovedDimensions(); - foreach ($columns as $colum) { - $instances[] = new $colum(); + foreach ($columns as $column) { + if (!in_array($column, $removedDimensions)) { + $instances[] = new $column(); + } } return $instances; } /** + * Returns a list of dimension class names that have been removed from core over time + * + * @return string[] + */ + public static function getRemovedDimensions() + { + return [ + // dimensions removed in Matomo 4.0.0 + 'Piwik\Plugins\DevicePlugins\Columns\PluginDirector', + 'Piwik\Plugins\DevicePlugins\Columns\PluginGears', + 'Piwik\Plugins\VisitorInterest\Columns\VisitsByDaysSinceLastVisit', + ]; + } + + /** * Returns the name of the plugin that contains this Dimension. * * @return string |