MDL-39087 Simplify get_uninstall_url() interpretation

The get_uninstall_url() method of all subclasses of plugininfo_base
class is now expected to always return moodle_url. Subclasses can use
the new method is_uninstall_allowed() to control the availability of the
'Uninstall' link at the Plugins overview page (previously they would do
it by get_uninstall_url() returning null). By default, URL to a new
general plugin uninstall tool is returned. Unless the plugin type needs
extra steps that can't be handled by plugininfo_xxx::uninstall() method
or xmldb_xxx_uninstall() function, this default URL should satisfy all
plugin types.

The overall logic is implemented in plugin_manager::can_install_plugin()
that respects the plugininfo class decision and vetoes it in certain
cases (typically when plugin or its subplugin is required by some other
plugin).
This commit is contained in:
David Mudrák
2013-04-12 01:44:35 +02:00
parent d7d48b4091
commit 73658371eb
11 changed files with 396 additions and 61 deletions
+2 -2
View File
@@ -1229,8 +1229,8 @@ class core_admin_renderer extends plugin_renderer_base {
$actions[] = html_writer::link($settingsurl, get_string('settings', 'core_plugin'), array('class' => 'settings'));
}
$uninstallurl = $plugin->get_uninstall_url();
if (!is_null($uninstallurl)) {
if ($pluginman->can_uninstall_plugin($plugin->component)) {
$uninstallurl = $plugin->get_uninstall_url();
$actions[] = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'), array('class' => 'uninstall'));
}