Do you clean up your self-written plugins’ at deactivation?

After developing some plugins for myself, some of them is ready to be published. For all, I’ve written deactivation functions, which deletes the set options, the database, etc. after themselves. But I’m having doubts about the reason for these, for example, what if it’s only a temporary inactivation?

What do you think, does a process need a cleanup hook for deactivation or not?

Related posts

Leave a Reply

2 comments

  1. You shouldn’t cleanup the database on the deactivation hook. As @Darhazer said, use the uninstall hook or create an uninstall.php inside the plugin folder.

    What you can do is to create an export settings page, which the user can use to save/backup his data. You could call this page before deativation, so the user will be prompted with an option to save the data if you really want to cleanup the database on deactivation.

  2. Use uninstall hook to delete all settings. On deactivation you can move temporary some data that was inserted in the plugin, like menu items, etc., but keep plugin settings active.