mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL_45619_m29v5' of git://github.com/sbourget/moodle
This commit is contained in:
commit
1c78065ad6
2 changed files with 44 additions and 4 deletions
|
@ -67,4 +67,34 @@ class repository extends base {
|
|||
public static function get_manage_url() {
|
||||
return new moodle_url('/admin/repository.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if there should be a way to uninstall the plugin via the administration UI.
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_uninstall_allowed() {
|
||||
if ($this->name === 'upload' || $this->name === 'coursefiles' || $this->name === 'user') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-uninstall hook.
|
||||
* This is intended for disabling of plugin, some DB table purging, etc.
|
||||
* Converts all linked files to standard files when repository is removed
|
||||
* and cleans up all records in the DB for that repository.
|
||||
*/
|
||||
public function uninstall_cleanup() {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/repository/lib.php');
|
||||
|
||||
$repo = \repository::get_type_by_typename($this->name);
|
||||
if ($repo) {
|
||||
$repo->delete(true);
|
||||
}
|
||||
|
||||
parent::uninstall_cleanup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue