// Get the submitted params
$disable = optional_param('disable', 0, PARAM_INT);
$enable = optional_param('enable', 0, PARAM_INT);
-$uninstall = optional_param('uninstall', 0, PARAM_INT);
-$confirm = optional_param('confirm', false, PARAM_BOOL);
$headingtitle = get_string('managemessageoutputs', 'message');
plugin_manager::reset_caches();
}
-if (!empty($uninstall) && confirm_sesskey()) {
- echo $OUTPUT->header();
- echo $OUTPUT->heading($headingtitle);
-
- if (!$processor = $DB->get_record('message_processors', array('id'=>$uninstall))) {
- print_error('outputdoesnotexist', 'message');
- }
-
- $processorname = get_string('pluginname', 'message_'.$processor->name);
-
- if (!$confirm) {
- echo $OUTPUT->confirm(get_string('processordeleteconfirm', 'message', $processorname), 'message.php?uninstall='.$processor->id.'&confirm=1', 'message.php');
- echo $OUTPUT->footer();
- exit;
-
- } else {
- message_processor_uninstall($processor->name);
- $a = new stdClass();
- $a->processor = $processorname;
- $a->directory = $CFG->dirroot.'/message/output/'.$processor->name;
- notice(get_string('processordeletefiles', 'message', $a), 'message.php');
- }
-}
-
-if ($disable || $enable || $uninstall) {
+if ($disable || $enable) {
$url = new moodle_url('message.php');
redirect($url);
}
echo $OUTPUT->header();
echo $OUTPUT->heading($headingtitle);
echo $messageoutputs;
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
$string['page-message-x'] = 'Any message pages';
$string['private_config'] = 'Popup message window';
$string['processortag'] = 'Destination';
-$string['processordeleteconfirm'] = 'You are about to completely delete message output \'{$a}\'. This will completely delete everything in the database associated with this output. Are you SURE you want to continue?';
-$string['processordeletefiles'] = 'All data associated with the output \'{$a->processor}\' has been deleted from the database. To complete the deletion (and prevent the output re-installing itself), you should now delete this directory from your server: {$a->directory}';
$string['providers_config'] = 'Configure notification methods for incoming messages';
$string['providerstag'] = 'Source';
$string['recent'] = 'Recent';
// delete message provider
message_provider_uninstall($component);
- // delete message processor
- if ($type === 'message') {
- message_processor_uninstall($name);
- }
-
// delete the plugin tables
$xmldbfilepath = $plugindirectory . '/db/install.xml';
drop_plugin_tables($component, $xmldbfilepath, false);
}
public function is_uninstall_allowed() {
- $processors = get_message_processors();
- if (isset($processors[$this->name])) {
- return true;
- } else {
- return false;
- }
+ return true;
}
/**
- * @see plugintype_interface::get_uninstall_url()
+ * Pre-uninstall hook.
+ *
+ * This is intended for disabling of plugin, some DB table purging, etc.
+ *
+ * NOTE: to be called from uninstall_plugin() only.
+ * @private
*/
- public function get_uninstall_url() {
- $processors = get_message_processors();
- return new moodle_url('/admin/message.php', array('uninstall' => $processors[$this->name]->id, 'sesskey' => sesskey()));
+ public function uninstall_cleanup() {
+ global $CFG;
+
+ require_once($CFG->libdir.'/messagelib.php');
+ message_processor_uninstall($this->name);
+
+ parent::uninstall_cleanup();
}
}