]> git.mjollnir.org Git - moodle.git/commitdiff
Adding the ability to perform custom uninstall tasks in modules. MDL-12520
authorstronk7 <stronk7>
Tue, 11 Dec 2007 23:39:32 +0000 (23:39 +0000)
committerstronk7 <stronk7>
Tue, 11 Dec 2007 23:39:32 +0000 (23:39 +0000)
Merged from MOODLE_19_STABLE

admin/modules.php

index 38454e56c39f67760dcb4c4e46c2078a11829264..85be458acbab8de7ed3040d7e047281962ad2993 100644 (file)
             // remove entent handlers and dequeue pending events
             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->directory = "$CFG->dirroot/mod/$delete";
             notice(get_string("moduledeletefiles", "", $a), "modules.php");