Closed (fixed)
Project:
Pathauto
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Nov 2007 at 21:46 UTC
Updated:
8 Sep 2008 at 14:48 UTC
Jump to comment: Most recent file
Comments
Comment #1
vito_swat commentedForgot one slash to properly delete alias
Comment #2
gregglesthanks very much for providing this, I think it will be a great feature.
One question - can you review this issue: http://drupal.org/node/188762
From a site of mine that uses image galleries it doesn't look like the image module provides any specific feed integration. So, we'll want to remove
+ $settings['supportsfeeds'] = '0/feed';
Also, if you can create your patch with "cvs diff -up" that makes it much easier to read.
Comment #3
vito_swat commentedDuring my studies on Drupal API I found very useful function
taxonomy_term_path(). With it's help I was able to simplify solution for non-standard categories like forums and image galleries. All vocabularies are now handled by taxonomy_pathauto hook whenever they are standard or not.To properly handle bulkupdate a hack was needed. I'm setting additional alias for taxonomy/term/[tid] to know that this term is already aliased. For example:
We have forum which source url is
forum/14. We set pathauto to set this url toforums/this-is-test-forum. After my patch there will be 2 rows in url_alias table:forum/14 -> forums/this-is-test-forumwhich is desired behaviorand
taxonomy/term/14 -> /forum/14which is needed for pathauro to know that this term is aliased.A nice side-effect is that even if we type in url
www.example.com/taxonomy/term/14we will get forum view instead of taxonomy view. If we have Global redirect module than Drupal redirects us straight onwww.example.com/forums/this-is-test-forum.I tested this patch with forum, image galleries and superb taxonomy redirect module and it's working fine.
Sorry for not creating my patch with -up parameter but my eclipse is unable to do it (or I don't know how to set up it properly).
Comment #4
eMPee584 commentedMhh I was just having the same issue (image_gallery's wired URLs) and was about to create some freak-patch for pathauto when I saw this.. do I need to apply the previous patch aswell.. or is this about to hit CVS anyways? thx & cheers..
Comment #5
greggles@zuriel please review the patch in #3. test it out, look at the code and the approach. look for ways to improve it, etc.
@vito_swat - I haven't tested this yet, but do thank you for your investigation and novel approach to this idea. Hopefully it will solve this problem in a general way.
Comment #6
vito_swat commentedThere's no rule to have [tid] in uncommon taxonomy source path (but most have) so feed path for such a term will be broken.
I have to rethink this code once again and I'll provide new patch during weekend. I'd like to implement this with much cleaner code and without 'dummy_taxonomy' thing.
Comment #7
vito_swat commentedThis is new patch against current dev. I think it's much cleaner now. Again tested with modules: forums, image galleries and taxonomy redirect.
It also fixes a bug with creating alternate feed aliases even if there was 'Create a new alias. Delete the old alias.' option selected. To sovle this (and to reduce code) I introduced a new function
_pathauto_existing_alias_data()which consist of part of thepathauto_create_alias().Comment #8
gregglesCan you clarify specifically what that bug is/was? I don't understand it from your brief description.
Also, please see RFC: should feed aliases get updated following normal "update action" settings? and discussion on groups.d.o about the topic of updating feed aliases when the underlying alias is updated.
Comment #9
vito_swat commentedProblem is exactly the same as described in RFC. I'll reroll patch tonight and I'll omit that part of the code until discussion ends.
Comment #10
vito_swat commentedThis took me little more than expected (I've so many work to do) but I finally rerolled the patch vs current dev and without changes in creating new feed aliases when 'Create a new alias. Delete the old alias.' option is selected.
Please review.
Comment #11
tj2653 commentedsubscribing
Comment #12
tj2653 commentedHi,
I tried this patch on a clean copy of Pathauto 5.x-2.x-dev. The image paths are working great now, but my forum paths aren't working anymore. I deleted all my aliases, and bulk generated everything. It looks like the paths are generated in the URL alias list:
forums/category/discussion taxonomy/term/1
forums/category/discussion/general taxonomy/term/2
forums/category/discussion/other taxonomy/term/3
But when I browse to the forums, here are the page locations:
Discussion http://mydomain.com/forum/1
-General http://mydomain.com/forum/2
-Other http://mydomain.com/forum/3
My setup in PathAuto is: [vocab-raw]/category/[catpath-raw], and this was working correctly before the patch. Any ideas?
EDIT: Actually, it's also not working for a few other sections, like blog and faq.
Thanks
Comment #13
herb commentedI just applied the pathauto_23.patch to the current dev version, and it seems to have fixed the problem I was having getting the image galleries to be correctly aliased.
I deleted all the category path aliases and then let the patched version run with the default settings for image galleries. Everything worked fine. I deleted them again, and changed the pattern to photo-albums/[catpath-raw].
It worked again, but gave a warning for each photo-album created.. user warning: Duplicate entry '2324' for key 1 query: INSERT INTO url_alias_extra (pid, dst, entity_type, entity_id, created_by) VALUES .........
However, the correct aliases were generated. Thanks
Comment #14
vito_swat commented@tj2653
Could you check if you have following aliases for forum (I assume you have /forum/1..3 as you noted):
taxonomy/term/1 -> forum/1
forum/1 -> forums/category/discussion
taxonomy/term/2-> forum/2
forum/2 ->forums/category/discussion/general
etc.
@herb
This warnings are not related with the patch I provided. They show also on clean dev release. Check: http://drupal.org/node/196465#comment-643634
Comment #15
tj2653 commentedHi vito_swat. The only forum-related aliases are the ones I posted above:
forums/category/discussion -> taxonomy/term/1
forums/category/discussion/general -> taxonomy/term/2
forums/category/discussion/music -> taxonomy/term/3
They used to point to forum/1, forum/2, etc. before the patch (I deleted all aliases, and regenerated all aliases with the patch).
Comment #16
vito_swat commentedWell it seems that forum module don't implement hook_term_path, so it still needs special handling. I reverted forum specific functions I deleted in previous patch (but I don't like this solution) and made issue #197864 in Drupal forum module to make it properly in core.
My forum module was heavily modified so in my test environment it was working... Please test it carefully with forum and image galleries (add, edit, delete terms and nodes for both modules).
Comment #17
tj2653 commentedThanks - before I test this out, is this expected to also fix my similar problems with blog and faq taxonomy aliases?
Comment #18
vito_swat commentedThis patch does not touch any blog aliases so I think your problem is not connected with this patch. If you have any other special taxonomies that don't work please provide detailed steps to reproduce the problem.
Comment #19
tj2653 commentedI should clarify that they were blog and faq taxonomies...for instance they used to look like:
blog/category/fashion -> taxonomy/term/50
blog/category/food -> taxonomy/term/51
faq/category/general -> taxonomy/term/28
faq/category/posting -> taxonomy/term/29
I don't have what they turned out to be after my first patch because I've rolled back the DB, but the URLs were not the same (not blog/category/fashion, etc). I just tried the new patch, and either I patched incorrectly, or there's a problem. It says 50 aliases were created, but the list only shows 2, which are malformed:
blog/category/food -> taxonomy/term/
taxonomy/term/ -> taxonomy/term/51
Comment #20
vito_swat commentedI still don't know what modules do you use!
You mention FAQ. The only FAQ i found was the http://drupal.org/project/faq. If this is module you use than it doesn't have hook_term_path implemented so it will not work with this solution unless you post feature request to implement it.
The blog taxonomy also seems to be non-standard but I don't know what module is generating it. Can you provide result of the query
SELECT vid, name, module FROM vocabularyon your database. It will help me to check if the patch will work for your modules.my results are:
1 Forums forum
2 vocab taxonomy
3 Image Galleries image_gallery
4 FAQ taxonomy
And it works for all the cases except FAQ as I mention above.
Comment #21
tj2653 commentedYes, that's the FAQ module. Here are the results:
1 Forums forum
2 Category taxonomy (faq)
3 Category taxonomy (Organic Groups - og)
4 Category taxonomy (a CCK content type)
5 Image Galleries image_gallery
6 Category taxonomy (another CCK content type)
7 Category taxonomy (Blog)
All of the URL aliases except for Image Galleries were working with Pathauto until I implemented the patch. Is it possible to just patch for image_gallery and leave everything else the way it worked before?
Comment #22
vito_swat commentedI'll ask you again what modules do you use? I cannot reproduce your issues. Especially I cannot create any special vocabulary for blogs, and faqs are working the same way as before the patch (without the alias).
Please provide complete step-by-step instruction how can I reproduce your issues starting from point: install and enable module XXX version ZZZ. I have clean drupal 5.3 install with enabled blog, forum, pathauto(dev) faq(2.5) and image(dev) modules and after applying the patch I can't make pathauto to behave in the way you mention.
If you don’t help me I couldn’t make the patch better. Making it only for image galleries is bad practice because there are other modules which uses taxonomy the same way as image galleries (ie. taxonomy redirect).
EDIT:
I played more with my test enviroment and I guess your problem is with incorrectly patched module. For your convenience as an attachment I provide files that changed.
Comment #23
herb commentedI use tried using the current pathauto_24.zip to replace my previously 23 patched 5.x-2.x-dev.
I deleted all url aliases using vocabularies and terms and it seemed to delete all aliases, except the image gallery aliases.
I regenerated all vocab url aliases, and it worked fine. However, I think the last patch let me delete the image gallery aliases.
CORRECTION: - I just went back to patch 23 and it exhibited the same erroneous behavior - it doesn't seem to delete the image gallery aliases when you delete all url aliases using vocabularies and terms.
Comment #24
tj2653 commentedHi,
I realized that when I applied the second patch, I did it on 5.x-2.0 and not 5.x-2.x-dev. That explains the strange behavior with the malformed URL aliases in #19. Patch #16 seems to be working for me now, with all my modules. The modules I listed in #21 were the only ones that I have installed that are related. Thanks for your help.
Comment #25
gregglesvito_swat - thanks for your persistence with this issue.
I'm uploading a re-rolled version since HEAD has changed somewhat. I didn't test this with forum aliases (i don't use forum) or forum feeds. I'll do that shortly.
Comment #26
gregglesI made one slight code change to remove the space between the function name and the ( in _pathauto_existing_alias_data( but otherwise this worked as specified and fixed some relatively annoying bugs.
Otherwise this is applied to DRUPAL-5--2 and just needs to be ported (probably it will apply cleanly, but I haven't tested yet).
Thanks so much, vito_swat.
Comment #27
gregglesSo...another question is how people can clean up their sites.
Should people delete aliases associated with image/tid/ and then edit/submit all of the terms for image galleries?
Also, after applying this I noticed that links from taxonomy/term/58 point to image/tid/58 and then image/tid/58 points to the actual alias.
Before the patch, aliases would get -0 added onto the end, now the (less important) taxonomy/term alias points to something that is not very friendly. I'm sure we'll get some people who don't see it as an improvement. The way this patch creates aliases makes the global redirect module pretty important.
Comment #28
Taiwan commentedI have a question regarding the best way to go about creating paths for taxonomies within my site.
The end result is I want to see a url liek this:
www.sitename.com/taxonomy/*identifier*/title where identifier is not a token, but taxonomy and title are.
I have already created 4 separate taxonomies, and some of them I don't want/need showing up as their own url. do you have any advice for this?
Comment #29
gregglesfixed in HEAD as well.
@Taiwan - your question is totally unrelated to this thread. Please open a new issue or ask your question in a different place instead of just adding it to some random issue.
Comment #30
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #31
nancydruThere was a piece missing: http://drupal.org/node/238213. Please apply the patch and test. Thanks.
Comment #32
gregglesHere's the patch from that issue for completeness...
Comment #33
nancydruMissing a one line piece: patch attached.
Comment #34
gregglesApplied to both HEAD and 5.x-2. Thanks, NancyDru.
Comment #35
nancydruThank you.
Comment #36
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #37
mariagwyn commentedDoes anybody know if this was applied in the drupal 6.x version?
I ask b/c I have that version installed, and when I override my Image taxonomy, to get it to work, I have to do two steps:
1. Override using tax_redirect from tax/term/# to image/tid/!tid.
2. Manually create aliases from image/tid/# to image-galleries/friendly-name/friendly-name.
If I understand this thread (and I may not), this should do this automatically. Or no?
thanks,
maria
Comment #38
greggles@mariagwyn - please update to the latest 6.x-1.x-dev which had a small fix related to this and should fix your problems.
Comment #39
mariagwyn commentedI updated to 6.x-2.x-dev, an all seems well. Thanks!
M
Comment #40
mariagwyn commented