Menu item is not cached / Code clean-up

sun - May 8, 2008 - 02:34
Project:Shared Sign-On
Version:5.x-1.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

This is a no-brainer. SSO's menu item is parsed once on each cached page request, twice on each uncached page request.

AttachmentSize
singlesignon-DRUPAL-5.menu_.patch1.08 KB

#1

sun - May 8, 2008 - 03:06

Further code clean-up.

AttachmentSize
singlesignon-DRUPAL-5.clean-up.patch 13.81 KB

#2

sun - May 8, 2008 - 10:35
Title:Menu item is not cached» Menu item is not cached / Code clean-up
Version:5.x-1.2» 5.x-1.3

Re-rolled.

AttachmentSize
singlesignon-DRUPAL-5.clean-up.patch 13.82 KB

#3

wayland76 - May 17, 2008 - 06:44

I just noticed this, and have a quick question; why have you removed the access check in singlesignon_admin_settings -- is it because this check is already done elsewhere?

Other than that, it looks pretty good, although there's one or two spots where I prefer it the way it was (for example, the if statement with $master_url and the bots, I prefer the original comments as being more informative). Don't re-roll, though; if you answer the question above, I'll apply the patch, and make the small changes I prefer afterwards. After all, I'll have to roll this patch for 6.x as well :).

#4

wayland76 - May 17, 2008 - 06:49

Oh, and BTW, you're not supposed to set your own patches to "reviewed and tested by the community", but to "patch (code needs review)". But now that I've reviewed it myself, I'll leave it.

#5

wayland76 - May 17, 2008 - 06:50

...and if I haven't said, it's a pleasure to have a guy of your obvious level of Drupal familiarity doing this.

#6

sun - May 17, 2008 - 20:21

1) singlesignon_admin_settings() is a menu callback and not invoked elsewhere. Thus, it's sufficient to define 'access' in hook_menu().
2) Please reconsider changing this comment -- it's very much cleaner and absolutely easy to understand:

<?php
// If no master URL is set or we are serving a bot, do nothing.
+  if (!$master_url || _singlesignon_is_bot()) {
+    return;
   }
?>

#7

wayland76 - May 19, 2008 - 02:36

The problem with the comment is it says what we're doing (which should already be obvious from the code), but doesn't say why

#8

wayland76 - May 19, 2008 - 02:57

Ok, it's now in the DRUPAL-5 branch

#9

wayland76 - May 19, 2008 - 03:09

...and I've also committed something similar on the Drupal 6 branch. However, I'm planning to wait until the 25th of May 2008 before I release a new version.

#10

sun - May 19, 2008 - 22:55
Status:reviewed & tested by the community» fixed

#11

Anonymous (not verified) - June 2, 2008 - 23:01
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.