Uninstall general type plugin

Uninstall general type plugin

by Itamar Tzadok -
Number of replies: 5

Is it possible that, by design, general type plugins with DB may be installed but not uninstalled? I couldn't find anywhere in the code to suggest otherwise. Surely(?) I'm missing something. Suggestions? smile

Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: Uninstall general type plugin

by Itamar Tzadok -

Even if there is no DB, removing the plugin folder merely omits the plugin from the list but does not seem to remove the respective record from mdl_config_plugins. Does it somehow expire? OR seriously? smile

In reply to Itamar Tzadok

Re: Uninstall general type plugin

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What do you mean by a 'general type' plugin? 

There is now an API function uninstall_plugin that does all the necessary clean-up. However, to be able to invoke that through the Moodle UI requires that plugin type to have a Manage ... plugins page under Plugins in the admin menu, and not all pluigns have that yet.

(Also, there are some like qtypes, where it is using old code, not the uninstall_plugin function. I should fix that. MDL-32324)

In reply to Tim Hunt

Re: Uninstall general type plugin

by Itamar Tzadok -

A 'general' plugin is any plugin that is not one of the following types:

block
filter
mod
qbehaviour
qtype
auth
enrol
message
repository
portfolio
theme
mnetservice
tool
report

For example, a course format plugin. The plugintype_general class is empty. But surely, if the plugin manager can do a default install of a general plugin, it should be able to do a default uninstall. smile

In reply to Itamar Tzadok

Re: Uninstall general type plugin

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Interesting point Itamar as course formats can define DB tables and attributes and as there is no 'course_format.php' in the '/admin' folder that calls the function 'uninstall_plugin' like 'localplugins.php' for example, then removing a course format by removing it's folder (which works fine when no DB additions) leaves stale DB tables, attributes and rows.

Is this a new MDL issue?

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Uninstall general type plugin

by Itamar Tzadok -

I don't know if that's new but really this is like having add_instance in a module lib without its delete_instance counterpart. Btw, afaict removing a course format by removing it's folder doesn't work fine when no DB additions, because the record in mdl_config_plugin is not removed. smile