]> git.mjollnir.org Git - moodle.git/commit
accesslib: has_capability() now supports fake $USER for forum cron
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:20:24 +0000 (07:20 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:20:24 +0000 (07:20 +0000)
commit1a9b67874fe7300f7820eb664a25d48f3f5f6f7d
treee89d77078fba394e4f5663c48b724772693cf7c4
parenta5d81e5e5e7a1736b730c2e7ae51ed9e30618a7b
accesslib: has_capability() now supports fake $USER for forum cron

has_capability() can handle the fake user that forum cron sets up
and will load the appropriate accessdata into $USER->access.

This makes forum cron work again. A test comparison between before
this patchseries yields:

With 1 forum post, sent total 24 times
 - Before 11 000 DB queries (approx)
 - After     506 DB queries

With 6 forum posts, sent a total of 452 times
 - Before 47 876 DB queries
 - After   8 256 DB queries

There is a very high variability, but we are going from 100-500
queries per sent email to 18-21 queries per sent email. The
variability probably stems from 2 of the 6 posts being in a 200-user
forum.

Still huge - by the time we are sending the email, we should know
everything we need to know about the user, the forum/thread/post and
the form. The average should be well below 1 DB query per email sent!
lib/accesslib.php