]> git.mjollnir.org Git - moodle.git/commit
pagelib: Course page - preload child contexts and smarter user_allowed_editing()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 06:53:09 +0000 (06:53 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 06:53:09 +0000 (06:53 +0000)
commite1e1f498201f8852755cbbbfc5eeb7f476bca1cd
treef5be3edaaf5877ee8c8606dcbddcee4ada51b5f7
parent0532aec946fbd2e4757bd7cea04fe4842fc19a37
pagelib: Course page - preload child contexts and smarter user_allowed_editing()

With this patch we preload the child contexts for the course
and hold on to them. This means that in one DB query we have all the contexts
we are going to need.

The checks for user_allowed_editing() move from weblib:update_icon() to
user_allowed_editing(), where we cache the result, and in the process save
50% of the cap checks by testing separately blocks from modules (doh!).

Still, the cap checks here are very inefficient...

With the last 3 patches, a course page with default blocks and 9 modinstances
goes from 157 to 86 db queries when logged in as a non-editing user (guest,
student). As admin it drops from 88 to 81.

Conflicts:

lib/pagelib.php
lib/pagelib.php