New categories need a context immediately, and for top-level
categories, they also need to taint the "root" context to trigger
a reload of $USER->access.
This fixes problems with creation of initial courses(MDL-11178),
duplicate misc categories, etc.
- The code uses the system context a lot. Declare
$sysctx at the top and use it.
- If the category has a context property, use it
(saves 1 DB query per category displayed)
The DB costs of this page in editing mode are
- ~100 DB queries for fix_course_sortorder()
- ~50 DB queries for the categories listing
If we rewrite both to lose the recursion, we could resolve the
page in perhaps 5 DBq.
Move the fixups for orphan courses to the newly minted
fix_coursecategory_orphans() -- and optimise it to take only 1 dbquery for
the common case.
If we do find lots of orphans, we issue 2 updates per orphan.
This cuts down dbqueries drastically - we used to have 2x the number of
courses in the site.
The API was changed slightly so that has_capability now takes the
whole $context object (we almost always have it anyway)
The $kill thing was removed. If you want to assert a capability
then use:
require_capability('capname', $context);
with optional variables to modify the error message
Misc bugs here and there also removed and code tidied
=======================================
WARNING: DEV IS CURRENTLY VERY UNSTABLE.
This is a mega-checkin of the new Roles system. A lot of changes have
been made in core and modules.
Currently there are a lot of rough edges and known problems. We are
working hard on these .. .the reason for getting this into HEAD at this
stage is enable us to move faster (our branch was diverging from HEAD
too much).
Please keep an eye on http://docs.moodle.org/en/Roles for current status
and information for developers on how to use the new Roles system.
and admins can approve or reject pending courses.
Also, contains the ability to restrict activity modules on a per course basic. Strict config options:
enable restricting modules at ALL (for all courses, no courses, requested courses), what to do by default for newly created courses
as well as what modules to enable for above category by default.
This feature was created for the aim of building a community side to moodle - for institutes that have strict courses and enrolments, allowing normal users to request interest courses is a good feature,
but some modules may be redundant (assignment, lesson, quiz etc)
Please test!