When installing a plugin, it will not install if the directory to which it is attempting to install already exists. This means that users of our plugin must first manually deactivate and delete the plugin.
Is there any way to forcibly overwrite the directory or to deactivate the plugin and delete the directory at installation?
The only solution I can come up with is to deactivate and delete the previous version on activation, but not only would this require versioning the plugin directory, it would also apparently require versioning all of the plugin’s functions.
If you’re manually installing a plugin, you need to disable and delete the old version. However, WordPress does allow you to update your plugin programatically.
If your plugin is hosted on the WordPress.org repository, it will prompt the users to install updates for you. You’ve likely seen this with Akismet and other plugins already.
If your plugin isn’t hosted on the WordPress.org repository, there are a few other things you can do. Many premium theme/plugin shops are including their own update scripts in their releases. It allows them to push out updates to their customers that use the standard WordPress update mechanisms to download the new package, install it, and remove old files.
Here are just a few examples: