/** * @see plugintype_interface::get_uninstall_url() */ public function get_uninstall_url() { $processors = get_message_processors(); if (isset($processors[$this->name])) { return new moodle_url('/admin/message.php', array('uninstall' => $processors[$this->name]->id, 'sesskey' => sesskey())); } else { return parent::get_uninstall_url(); } }
/** * Helper method that implements common uninstall prerequisities * * @param plugininfo_base $pluginfo * @return bool */ protected function common_uninstall_check(plugininfo_base $pluginfo) { if (!$pluginfo->is_uninstall_allowed()) { // The plugin's plugininfo class declares it should not be uninstalled. return false; } if ($pluginfo->get_status() === plugin_manager::PLUGIN_STATUS_NEW) { // The plugin is not installed. It should be either installed or removed from the disk. // Relying on this temporary state may be tricky. return false; } if (is_null($pluginfo->get_uninstall_url())) { // Backwards compatibility. debugging('plugininfo_base subclasses should use is_uninstall_allowed() instead of returning null in get_uninstall_url()', DEBUG_DEVELOPER); return false; } return true; }
public function get_uninstall_url() { if ($this->name !== get_config('moodlecourse', 'format') && $this->name !== 'site') { return new moodle_url('/admin/courseformats.php', array('sesskey' => sesskey(), 'action' => 'uninstall', 'format' => $this->name)); } return parent::get_uninstall_url(); }