Adding the ability to perform custom uninstall tasks in modules. MDL-12520

Merged from MOODLE_19_STABLE
This commit is contained in:
stronk7 2007-12-11 23:39:32 +00:00
parent 89d7d96279
commit 6030279805

View File

@ -156,6 +156,17 @@
// remove entent handlers and dequeue pending events // remove entent handlers and dequeue pending events
events_uninstall('mod/'.$module->name); events_uninstall('mod/'.$module->name);
// Perform any custom uninstall tasks
if (file_exists($CFG->dirroot . '/mod/' . $module->name . '/lib.php')) {
require_once($CFG->dirroot . '/mod/' . $module->name . '/lib.php');
$uninstallfunction = $module->name . '_uninstall';
if (function_exists($uninstallfunction)) {
if (! $uninstallfunction() ) {
notify('Encountered a problem running uninstall function for '. $module->name.'!');
}
}
}
$a->module = $strmodulename; $a->module = $strmodulename;
$a->directory = "$CFG->dirroot/mod/$delete"; $a->directory = "$CFG->dirroot/mod/$delete";
notice(get_string("moduledeletefiles", "", $a), "modules.php"); notice(get_string("moduledeletefiles", "", $a), "modules.php");