accesslib: get_assignable_roles() reworked to be constant-queries
commit2dff3a06810757967bb519f5d36c4ea555add43a
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:27:46 +0000 (19 07:27 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:27:46 +0000 (19 07:27 +0000)
tree66232993e363411396a1db2c8405d9cc11d2af2c
parentdfbf98cdb35ceec3a9de60b37bb62fcab1ca19df
accesslib: get_assignable_roles() reworked to be constant-queries

get_assignable_roles() was calling user_can_assign() (cost of 1~2 DBq)
once-per-role. Instead, we can do a single DB query that answers
all our questions in one go.

On a Moodle w 8 roles defined, saves 19 DB queries for the course page
for teachers/admins.

NOTE NOTE NOTE! With this patch we drop the insane strip/escape bit.
Only the caller knows if this is for display on html or for other uses,
so we'll be true and not mangle the data.

A review of all callers in 1.8 shows no problem - the strings were being
strip/escaped already.
lib/accesslib.php