5

Is there any way to get a magento extension uninstall hook,the problem is that if user will uninstall my module then some dependent modules will become unstable so i want to show him a notification before uninstallation

  • No, but turn it around. If the depending modules cannot find that module, disable them, by renaming the module file if possible and cleaning confusion cache, or failing that, return false for isModuleEnabled() helper method. – Melvyn Jun 9 '15 at 7:17
  • @Melvyn, why don't you write that as an answer? ;) – 7ochem Jun 10 '15 at 7:39
1

To an extent that depends on what kind of uninstall you're talking about.

Magento Connect modules can be uninstalled through the Connect manager, and that action is processed in downloader/lib/Mage/Connect/Command/Install.php::doUninstall(). But to my knowledge, there's no way to hook into that.

Otherwise, you're talking about people manually disabling or removing your module files. The only way to detect that would be to have some code that lives outside the module and recognizes when said module is no longer present. Not a good idea.

Your best option is to provide solid documentation that explains the uninstall process, and problems that can arise after doing so.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.