Forums » Development »
Uninstalling Plugins
Added by Muntek Singh over 14 years ago
Removing a plugin is apparently a black art. Without some serious googling, I doubt anyone but the 2-3 people who post regularly here and are familiar with the code know how to do it "properly"
Plugins should be similar to wordpress, where one-click install and one-click removal are the norm, and you also have the ability to "activate" and "deactivate" plugins at will. This is especcially important with the agreed upon track of Core->Core Plugins->Plugins we have adopted.
What are the technical challenges to doing this?
Replies (8)
RE: Uninstalling Plugins - Added by Holger Just over 14 years ago
I think, the first step should be a rake task which allows the following two options. It could possibly be coupled / integrated to your plugin directory :)
Installing¶
- Check the name (directory) of the plugin and complain if unexpected.
- Run all migrations
- perform rake tasks specific to the plugin (definable by the plugin itself)
Uninstalling¶
- Ask the user if she really want to do this, as it is going to delete all data
- Run the down migrations to version 0
- delete the code
- Optionally, it could be renamed / moved. We could change the engines loader to ignore plugins which have a
.disabled
added
- Optionally, it could be renamed / moved. We could change the engines loader to ignore plugins which have a
Also it is necessary to teach plugin authors to properly develop and test their down migrations.
Only disabling a plugin is not so easy. If you just keep disable the code but the database changes, you can face serious data inconsistencies if needed callbacks are not run. This should be only available if the plugin explicitly states that this is supported.
--Holger
RE: Uninstalling Plugins - Added by Felix Schäfer over 14 years ago
Holger Just wrote:
- Ask the user if she really want to do this, as it is going to delete all data
- Run the down migrations to version 0
Make it very very very clear then, I just migrated one of my plugins to 0 on a test system because I had made changes to the latest migration, and boom all my hand-crafted test data was gone…
RE: Uninstalling Plugins - Added by Holger Just over 14 years ago
Felix Schäfer wrote:
Make it very very very clear then, I just migrated one of my plugins to 0 on a test system because I had made changes to the latest migration, and boom all my hand-crafted test data was gone…
We could have the massage in bold blinking red and have the user actually type in "Yes, I know what I'm doing."
On the other side, they are all Unix admins (except the Windows guys :). So they should know what they do all the time anyway.
--Holger
RE: Uninstalling Plugins - Added by Jan from Planio www.plan.io over 14 years ago
bold blinking red +1
:)
RE: Uninstalling Plugins - Added by Jean-Baptiste Barth over 14 years ago
Interesting ideas!
It's not so complicated to install or uninstall a plugin now with our versions of rails and engines. I think we should first drop this useless "migrate_plugins" rake task and make it clear, in a wiki page, how to install/uninstall a plugin. It's just a "db:migrate NAME=blah VERSION=0" + remove the folder, nothing complicated behind.
Complications appear when you install a plugin, upgrade redmine, then try to uninstall it, if the plugin is incompatible with core database migrations, such as subtasking plugin. But I think we'll never find a good solution for that.
Muntek: about your idea of "one click installable plugins", the main challenge is the restart of application server. A redmine administrator is not necessarily the system administrator of the machine, or he may not have access to the machine immediately. In most cases, plugin installations won't have any effect if you don't restart the application, but uninstallations could lead to 500 errors everywhere.. I wonder if some other rails app (maybe radiant?) have a solution for that.
RE: Uninstalling Plugins - Added by Jean-Baptiste Barth over 14 years ago
Sorry it's "db:migrate:plugin NAME=blah VERSION=0" of course.
RE: Uninstalling Plugins - Added by Mike S. almost 12 years ago
Two years later, it's apparently now:
redmine:plugins:migrate NAME={plugin} VERSION=0
For example (actually using jruby, but all the same)
$ jruby -S rake db:migrate:plugin NAME=redmine_backlogs VERSION=0 Migrating redmine_backlogs (Redmine Backlogs)... Note: The rake task db:migrate:plugin has been deprecated, please use the replacement version redmine:plugins:migrate $ jruby -S rake redmine:plugins:migrate NAME=redmine_backlogs VERSION=0 Migrating redmine_backlogs (Redmine Backlogs)...