Resolution: Won't Fix
Add db/hooks.php to some plugin with a callback for \core\hook\pre_delete_course
Output something in this callback.
Create and delete the course
Make sure the output was printed
At the moment Moodle has plenty of little APIs (consisting of one-two functions each) that require plugins to define PLUGINNAME_CALLBACKNAME() functions in their lib.php files.
... (and so on, just grep by "component_callback" or "function_exists" )
There are several problems with this approach:
- bad documentation, hard to know about all various existing callbacks
- easy to confuse the arguments because there is no interface
- necessary to include all lib.php files (which are sometimes huge) to find handful of plugins implementing functions - SLOW!
- limiting implementation to one plugin type because otherwise it's too expensive to look for callbacks
Suggested approach that was discussed on backend meetings, especially with skodak is to use hooks and class autoloading.
There is no goal to convert all existing APIs into the new format ASAP but will be nice to gradually do it, slowly deprecating old-style callbacks.
There are at least two issues that would benefit from the agreement on standard:
- MDL-43742 converting recent activity callbacks (atm we need to implement two very similar callbacks in each module)
- MDL-24359 extending course reset callbacks to other plugin types (i.e. blocks)