- ddllib.php: Where all the DDL (install/upgrade) functions will be.
- dmllib.php: Where all the DML (select...) functions will be.
- datalib.php: Legacy lib. Its contents should go to other libraries soon.
For more info see: http://docs.moodle.org/en/XMLDB_Roadmap (point 1)
get_courses_page() uses get_records_sql() which means that it will actually
break if the first field requested isn't c.id. This in turn means that
the DISTINCT is not needed at all.
So let's go fast again!
get_records etc are not inefficient if used correctly, and result in MUCH
more readable code that get_recordset does.
I'm already starting to see code being submitted that takes these
instructions literally and it looks like Java. :-(
require_login seems to be the best place to capture this, however
I'm sure there are a few little places where it won't work.
We need to hunt these places down and fix them, because I would
like to rely on COURSEID and remove all the "global $course" hacks
that are floating around.
Probably later we need the full object $COURSE as well (to match $SITE)
Previously we were literally doing hundreds of database queries, now it's
very much faster.
This makes the API slightly more complicated, but it's definitely worth it!
Each module should implement modname_print_overview, which takes an array of courses
and an array to fill up indexed by [$courseid]['modname'] for the controller to loop through and print.
Each module should LIMIT the number of queries to use, all module instances can be fetched
with the new function get_all_instances_in_courses which is the same as get_all_instances_in_course
but takes an array of courses to fetch the instances for. This means there is no need to loop
over the courses array and fetch the instances for each course (dramatically cutting down the number of queries!)
(instead of the first, non-cached, invocation). Also, modified one
condition with no sense now. Needs testing (specially from PostgreSQL,
although it should work and the bug would be solved.
(http://moodle.org/bugs/bug.php?op=show&bugid=4583)
appropriate get_recordset* function, instead of duplicating
code.
Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>