ActionDimensions

I was reviewing the new code that helps a person create a new dimension, but I had a few questions. First, in the ActionDimension.php, why don’t you all remove the field name from the option table when a plug-in is uninstalled?

Also, in VisitDimension.php, you all are good at looking to see of isHandlingLogConversion on the install and update, but why don’t you all look for that when you unistall the plug-in?

Re VisitDimension: We simply try to uninstall the dimension from both tables. It is easier to implement it this way (less complexity) and (should) work fine. Also there might be a possibility that a VisitDimension no longer implements the conversion but something went wrong when removing the column from log_conversion before. Did you run into a problem with this? I can see always uninstalling the VisitDimension from log_conversion might be a problem in case it does not implement conversion and if there is a ConversionDimension having the same column name and we would maybe uninstall this one although this is not wanted. I might add another check.

Re Option: This is basically a bug / not implemented feature and should be covered when working on Refactor updater and maybe installer · Issue #5985 · matomo-org/matomo · GitHub . Basically, the Piwik Updater creates those entries in the option table and a dimension does not know anything about this. So it should also not be responsible to remove it. Problem is the Updater does currently not get notified when a dimension is about to be uninstalled and so it cannot remove it. I can probably “hack” it if you need a solution for this? Did you run into a problem with this?

Update: I changed both “issues”. Options should be removed now and we will uninstall VisitDimension from conversion only if it implements it. Still curious if you ran into any issues?

I only ran into one issue with the option table. I unistalled my plugin in. Then when I tried to reinstall it, it did not add the fields back because the plugin thought it was already installed because the var was still in the option table. For the VisitDimension, I was just reading the code.