InaneCoding / Piwik-OpenCart-Ecommerce-VQMod

A repository for the Piwik Ecommerce mod for Open Cart using VQmod.
22 stars 17 forks source link

Improve module uninstall #12

Closed kevinb456 closed 10 years ago

kevinb456 commented 10 years ago

User query alerted me to the fact the uninstall is not handled well (or not performed at all?).

"I installed your Piwik module and now my store is broken : ( I then uninstalled it, as well as Piwik service, and my website is still broken. Please help me." ... "[function.require-once]: failed to open stream: Success in /home/****/public_html/catalog/model/tool/piwik.php on line 46"

This means the PiwikTracker.php file is not being found. This could be due to user error (not following install instructions), but even so this 'require' statement should not be run at all once the mod is 'uninstalled'!

After investigating, the 'Uninstall' button on the admin Modules page does the following; 1) Deletes the rows from the database 'settings' table relating to the module (i.e. removes the settings info stored by the module). 2) Deletes the rows from the database 'extensions' table relating to the module (??what practical effect does this have?) 3) Runs the 'uninstall' function in the 'admin/controller/module/piwik.php' file, if it exists!

No uninstall function currently exists - write one? Possibly only needs the VQMOD XML file deleting (or disabling). Look into further.

Could also make sure the 'init' function is only run if tracking is enabled - currently the 'init' function is outside most of the IF statements which check if the mod is enabled. This means some code will run if the mod is disabled which probably shouldn't (e.g. including the PiwikTracker file). Could move everything possible inside the IF statements - possibly need to split into two initialisation functions as some basic initialisation is needed to determine the variables that the IF statements operate on. However, this may not be necessary if the mod is 'uninstalled' correctly.

Also think about 'dead' period inbetween user 'installing' and the user correctly editing the admin settings.

kevinb456 commented 10 years ago

Issue already effectively solved as part of fixing issue #13 .

This involved adding a check on the 'init' function to make sure the mod is enabled as suggested above. This also solves the 'dead' period issue.

Still no 'uninstall' function but should be okay as all calls in the vqmod file are 'safe' and just won't do anything unless the mod is enabled (which it won't be if (1) of the uninstall procedure above is done).

Mark as 'wontfix' and close, because could still add uninstall function but just not going to do it currently.