MDL-41437 fix and cleanup filter uninstall
This commit is contained in:
+28
-2
@@ -3100,6 +3100,19 @@ abstract class plugininfo_base {
|
||||
return $this->get_default_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 uninstall_cleanup() {
|
||||
// Override when extending class,
|
||||
// do not forget to call parent::pre_uninstall_cleanup() at the end.
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns relative directory of the plugin with heading '/'
|
||||
*
|
||||
@@ -3317,8 +3330,21 @@ class plugininfo_filter extends plugininfo_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/filters.php', array('sesskey' => sesskey(), 'filterpath' => $this->name, 'action' => 'delete'));
|
||||
/**
|
||||
* 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 uninstall_cleanup() {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('filter_active', array('filter' => $this->name));
|
||||
$DB->delete_records('filter_config', array('filter' => $this->name));
|
||||
|
||||
parent::uninstall_cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user