Closed (fixed)
Project:
Pathauto
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
13 Sep 2006 at 21:06 UTC
Updated:
30 Nov 2007 at 21:11 UTC
Jump to comment: Most recent file
Ex: only I can have blog on my site but I have 2 aliases (blog and blog feed), for every user
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | only_alias_blogabble_bloggers_83993.patch | 1.36 KB | greggles |
Comments
Comment #1
gregglesHello, thanks for the issue report.
Can you provide an explanation of how this is a "bug" as opposed to a "feature request". In my mind this is the intended behavior of pathauto, but I could understand that you desire it to behave in an augmented fashion.
What is the desired behavior that you have?
My understanding of the desired behavior is something like this;
On blog enabled sites the blog alias should only be generated if the user has the permission to write a blog.
On blog enabled sites, if the rights to blog are removed from a user then the alias to that blog should be deleted only if they have not created any blog posts.
Does that seem right?
If so, can you explain the benefit of this behavior? You have a slight reduction in the number of aliases on the site which has a small benefit for performance. Any other benefits that you can think of?
Comment #2
dyp commentedMay be on blog enabled sites the blog alias should only be generated if the user make 1st blog post?
Yes, I just want to make drupal faster.
Comment #3
gregglesI don't think this will make drupal faster. It requires lots of special case code. It requires pathauto to create hooks for either hook_node that does a check for "is this a blog post" and then "does this user already have a blog alias created" which will slow every node/user operation. The only speedup I see is accessing of the url_alias table - which is important - but at the expense in other very common areas.
If you want to speed up Drupal take a look at these points which are identified as bottlenecks:
http://buytaert.net/drupal-database-interaction
http://buytaert.net/drupal-webserver-configurations-compared
http://www.robshouse.net/drupal-performance-issues
So, I'm marking this as "postponed" in case there is another reason to do it or in case someone performs a benchmark test which shows a demonstrable performance improvement.
Comment #4
gregglesI just saw that in Drupal6 if a user doesn't have the permission to blog then blog/UID will return a "page not found" error. Since this now involves both performance penalty and creating aliases for a page that doesn't exist, I guess this is worth fixing.
Comment #5
gregglesI think this would be a nice thing to do so I'm assigning it to myself for 5.x-2.1.
If someone needs it sooner than I get to it, feel free to provide your own patch.
Comment #6
gregglesAnd here's a patch.
I'm not proud of the way I check the roles, but at least it works...If anyone has improved ideas I would love to hear it.
Comment #7
gregglesNote that a weakness of this patch is the following scenario:
1. Create users
2. Grant users the role "advanced" which does not have blog permission
3. Add blog permission to the advanced role
Expected results:
All users in "advanced" role now get an alias for their blog/UID path
Actual results:
The users in that role only get the alias when the user is next edited. Even a "bulk generate" doesn't fix the problem, you'd have to delete all user aliases and then bulk generate them from scratch...
I consider that deficiency a "won't fix" at this point because it needs a lot of changes elsewhere (e.g. a hook to listen for new roles, a better structure for the url_alias table, etc.)
Comment #8
gregglesApplied to both the 5.x-2.x and trunk.
Comment #9
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.