Uninstall Missing Plugins
The Site administration > Plugins > Plugins overview page is a really important section to check after any Moodle upgrades. This will list all the plugins on the site, as well as plugins that are Missing from disk which means they have been removed from the code tree but there still orphan configuration in the database (mdl_config_plugins
) for that plugin.
Ideally this should be cleaned up to avoid errors with missing plugin functionality. However, in the past it was quite tedious as you had to go through and open each Uninstall plugin link in a new browser tab and run through them all.
However, Moodle have now included an uninstall_missing_plugins.php
CLI script that allows you to remove plugins in bulk (yay).
First to see what's missing:
php admin/cli/uninstall_plugins.php --show-missing
Then to try a dry run of purging:
php admin/cli/uninstall_plugins.php --purge-missing
If that looks ok, go ahead and run it with:
php admin/cli/uninstall_plugins.php --purge-missing --run
There will be scenarios where the utility (or the plugins overview page) can't remove the plugin in which case you'll need to do some database surgery starting at the mdl_config_plugins
table looking for the plugin by type e.g. theme_essential
.
Just a note if you do delete anything out of the mdl_config_plugins
table don't forget to purge your Moodle cache completely before checking (as it may look like it didn't work, even with this CLI script).
No Comments