Closed (fixed)
Project:
Pathauto
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2007 at 12:56 UTC
Updated:
16 Sep 2007 at 14:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
gregglesThere are definitely situations of paths getting created which don't get deleted but these are mostly core issues. It shouldn't be pathauto's job to do this, but instead it should be done in user.module or node.module or taxonomy.module. The reason is that aliases can be built manually so there is a chance that an alias should be deleted and pathauto won't be around to do the deletes.
If you find situations where the aliases are not being deleted please file those against their respective core modules. Also, please be very specific about each separate instance so that people can understand what you are describing.
As I was thinking about this I realized that a handy feature to add to pathauto would be to delete old (non-existent) aliases. The feature would go through the aliases table and looking for node/nid% patterns for nids that no longer exist and then deleting them (and then do it again for users, and taxonomy).
Comment #2
niklp commentedFurther to that Greg, would it not also be a simple task to have a checkbox next to each alias that could be used to delete multiple aliases at once? Renaming a category (vocab) renders all old aliases useless, and deleting these manually is a pain. It's understood that this could probably be accomplished directly in the DB, but this is outside of a lot of normal users' skill-sets.
Comment #3
gregglesNikLP - I think you are confusing the pathauto pages and the drupal core url aliases page. Adding a checkbox next to each alias is something that should be added to drupal core and not just an add-on from an external module. If you want to see that (which it seems like a nice idea, so I suggest you do) then please submit an issue for drupal core related to that.
Comment #4
gregglesChanging version. I also kind of like this idea and have done some work on it. I think it's possible and potentially beneficial, even if it's only a matter of adding documentation to show people how to do this instead of actually including the delete statements in code.
Comment #5
senpai commented[Changing the title to make it more readable and direct.]
I have been thinking for some time that Pathauto should have an admin interface to allow deletion of all aliases that match a certain pattern. In the Starting Over: docs page, it states that:
Well, what if the Pathauto admin page offered a fieldset that had a place for "Delete all aliases that begin with the pattern ___"? Users who had accidentally created a bunch of aliases for one of their content types, and who didn't want to re-generate ALL their aliases due to some behind-the-scenes customizations or something, could use that box to nuke the 200 offending aliases without harming all their other carefully crafted ones. The SQL would be simple, since you don't have to offer GUI options for 'begins with', 'contains', 'ends with', or any other fluff.
I'm thinking that users who want to bulk-delete aliases selectively are most probably going to know the initial path of those aliases. Something like "pathauto/tutorials/[nid]/" or somesuch. After all, if you really need the functionality to delete aliases that only have a "3" in the seventeenth position, you're most likely going to want to do that in the database itself because you actually knew that it was possible to do that, so therefore you know how to write the SQL to do it anyway!
Thoughts?
Comment #6
senpai commented[Followup to my own followup. Classy!]
After an IRC discussion about the subject, it seems to make sense that allowing a user the ability to delete all aliases that *begin* with a certain pattern can't be too terribly dastardly, provided there's some sort of flag or confirmation before nuking commences. A user who mistakenly creates a pattern of "example/path/" that was then auto-generated using bulk update is gonna know that if they type that same string into the Delete field it will get rid of all the aliases they just made.
Before the Delete is processed against the db, Pathauto should count how many aliases will be nuked, and confirm that to the user with a "You are about to delete all 201 aliases beginning with 'example/path/'. Are you sure?"
Comment #7
gregglesThis is actually for a slightly separate issue than the initial one...but here's a fun related patch that does what senpai hijacked this thread into...
Comment #8
gregglesFwiw, I'm changing the focus - thanks for the hijack!
The original problem is a real pain.
Here are two queries that I worked out that achieve some of this:
These may be mysql only and they may not work well if you have /feed aliases as well. I'm providing this as a start, but really creating these things is just too much of a pain for me right now.
Comment #9
gregglescleaner patch - this is probably what I'll actually commit
Comment #10
senpai commentedIt appears this patch has been committed to the latest pathauto .dev, cause applying this against pathauto.module v1.44.4.21 results in a:
"Hunk #4 failed at 298"
Has this baby been committed already, or am I doing something wrong here?
Comment #11
senpai commentedUmmm, I D 10 T error. I was just informed by Update Status that there is indeed a newer dev version of Pathauto available. I shall commence downloading just as soon as I can relocate the mother ship.
Senpai out.
Comment #12
senpai commentedI applied the granular_0.patch to pathauto 5.x-2.x-dev (aug 26th version) successfully. I was then greeted with a
message on the 'delete all aliases' tab of the Pathauto Settings. This was not there before the patch, because I tried all those tabs just before patching the module.
Comment #13
greggles@senpai - clear the menu cache :/
One hunk fails if you use the latest 5.x-2.x code - but it's not important...
Comment #14
gregglesI committed this to the 5.x-2.x branch. Thanks everyone for your ideas, input, and reviews.
Comment #15
(not verified) commented