[#8684] Reduce number of calls of hasPermission(PERMS_READ)
Summary Reduce number of calls of hasPermission(PERMS_READ)
Queue Kronolith
Queue Version FRAMEWORK_3
Type Enhancement
State Resolved
Priority 1. Low
Owners Jan Schneider <jan (at) horde (dot) org>
Requester patrick (dot) abiven (at) apitech (dot) fr
Created 11/06/09 (125 days ago)
Due
Updated 11/07/09 (124 days ago)
Assigned
Resolved 11/07/09 (124 days ago)
Attachments
Milestone 2.3.3
Patch No

History
11/07/09 Jan Schneider Comment #2
Milestone ⇒ 2.3.3
State ⇒ Resolved
Assigned to Jan Schneider
Reply to this comment
I decided to only consolidate the two read permission checks inside 
getLink(). It would really reduce readability and maintainability if 
this (and only this, i.e. not the delete and edit checks) is moved out 
of this method.
11/06/09 patrick (dot) abiven (at) apitech (dot) fr Comment #1
State ⇒ New
Patch ⇒
Milestone ⇒
Queue ⇒ Kronolith
Summary ⇒ Reduce number of calls of hasPermission(PERMS_READ)
Type ⇒ Enhancement
Priority ⇒ 1. Low
Reply to this comment
Hello
In lib/Driver.php, adding a new optional argument $permsread in the 
getLink() function enables a valuable optimization (15 seconds instead 
of 21 seconds in our scenario). Instead of calling 3 times 
hasPermission() we just do a single call.

In lib/Views/Month.php, function html()
$permread = $event->hasPermission(PERMS_READ);
$event->getLink($timestamp, true, $this->link(0, true, $permread)

And then in lib/Driver.php, function getLink() we do not call twice 
hasPermission but we use the optional argument.

Regards