]> git.mjollnir.org Git - moodle.git/commit
accesslib: Intro global $ACCESS and load_user_accessdata()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:06:55 +0000 (07:06 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:06:55 +0000 (07:06 +0000)
commit204a369c1e20f1830e7ceb86baf2e6503c36c200
treeecd3819f972d66f9415b2e7027d18ccfd20ac21b
parentd7d4b0e572e3fb0cd99a6987093b392bdd133fd9
accesslib: Intro global $ACCESS and load_user_accessdata()

This patch introduces a new global $ACCESS that will cache
accessdata (our ra/rdef array) for users that are _not_ the
logged in user.

Most of the time it will be empty (luckily).

Each new user we have to get "in" costs us 3 or 4 cheap
dbqueries at the moment, so it is not that bad.

has_capability() now calls load_user_accessdata() if the
call is for a non-logged-user. So $ACCESS is autopopulated
transparently.

This also means that has_capability no longer calls
has_capability_old(). Yay!

With this patch, user/view.php for looking at a user in a course...

  Before: 62 dbqueries, 10.3MB, 0.7s
  After:  49 dbqueries,  8.5MB, 0.3s
lib/accesslib.php