Plugins

List of Plugins

There's a simple way to get a list of all the plugins on your site. You can use the mdl_config_plugins table and look at the version attribute.

For example:

select * 
from mdl_config_plugins 
where name = 'version' 
order by plugin;

Disable Plugin Installation

A really simple way to disable the installation of a single plugin is to set the value:

$plugin->version = 0;

In the plugin’s version.php file. For example the plugin might be failing etc.

If you want to disable plugin installations from within the site via the navigation:

Site administration > Plugins > Install plugins

Set the following flag in config.php. This might be a good idea if you have non-technical users with Site administration access, otherwise there could be trouble!

$CFG->disableupdateautodeploy = true;
Remember to clear your cache for this setting to take effect.

Forcing Plugin Reinstallation

The easiest way to get moodle to re-run installation is to update the version in version.php.

However, if you want to be sure it makes any schema changes etc then remove the plugin version from the mdl_config_plugins table or use the Site Configuration CLI tool.

NOTE: you can leave the other configuration there if required to save re-setting up the plugin.

The SQL to do this:

delete from mdl_config_plugins 
where plugin = 'plugin_name' 
and name = 'version';

For schema changes, you may need to drop the table and have it rebuild it just to ensure that the changes are made correctly.

For production deployments you should use an upgrade.php script, but this is a handy shortcut if you are developing a plugin as you really just want to iterate to the final schema version which you would then put into upgrade.php.