I keep seeing people in Drupal planet change their title and the link that got into the aggregator fails. If these people can't figure out the benefits from path_redirect by having it as a recommended module then we should help them figure it out more...like making it required and the default action.
The patch is trivial, I'm inserting it here first to discuss whether there are any downsides to this.
The only downside I can think of is that if path_redirect isn't upgraded to 7.x in time then that would slow the release of Pathauto. I don't see that happening, but if it does then we could temporarily make it not required/not the default again and make a bigger note about how much better pathauto is.
Another thing we could do is add a little bit of help text in the admin/build/path/pathauto that shows up only if they don't have path_redirect installed and which says "life is better with path_redirect, won't you try it?"
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 307644-pathredirect-D6-2.patch | 5.88 KB | dave reid |
| #14 | 307644-before.png | 24.71 KB | dave reid |
| #14 | 307644-after.png | 28.32 KB | dave reid |
| #14 | 307644-pathredirect-D6-2.patch | 3.54 KB | dave reid |
Comments
Comment #1
Freso commentedI must admit that I do not really like the idea of adding a module dependency if it isn't really dependent on it. And this isn't. I wouldn't oppose a "life is better with path_redirect, won't you try it?" message though, as that still leaves the final decision to the web admin.
Comment #2
gregglesOk, good points.
Comment #3
daniorama commentedHello, I would like a bit more Info about path redirect and global redirect. Should I use both or with Path redirect it's enough?
I have installed Path redirect but I don't know how to configure it to automatically work with pathauto. There are no information regarding to that in the README files of both Pathauto and Path redirect.
It would be really helpful a bit more information about how they work together and how to configure them (if it's not automatically done) It would be also really good if someone could provide more information about how to configure together Pathauto, Pathredirect, Transliteration and XML Sitemap. Thanks!
PS: more information would be enough motivation :)
Comment #4
gregglesSee #343855: New aliases are not being used for why this is a good idea.
@DaniOrama, Take a look at the "Update Actions" in the General Settings of Pathauto after you have enabled Path Redirect.
Comment #5
dave reidSubscribing to see how I can help with this issue from the path_redirect side.
Comment #6
dave reidSo I was brainstorming on how we can really improve this, and I've come across a few things:
So if path_redirect is enabled, the option now reads:
"Create a new alias. Delete the old alias. Automatically redirect the old alias to the new alias using the Path redirect module (recommended)."
And if path_redirect is not enabled, the option now reads:
"Create a new alias. Delete the old alias. To automatically redirect the old alias to the new alias, download and install the Path redirect module (strongly recommended)."
So now the code in _pathauto_set_alias in pathauto.inc:
And of course we'd need an upgrade path for users that have this variable set to 3 already:
Our end result will be that the default, out of the box settings for pathauto will work whenever path_redirect is enabled.
Comment #7
Freso commentedThat's awesome input, and even includes sample code. Excellent. Now we just need it as a patch... =)
I have one critique though, "Create new, delete own" essentially is to create the new alias and make the old one stop working. This is semantically different from "create new, make old one redirect" as this will still have the old path work. So if we want to do it this way, it would make more sense to couple it with 1, "create new, leave old" which says "create new alias, but let the old one still work". But perhaps it would simply make more sense to put a note in the
hook_requirements()when path_redirect exists and the update action isn't set to use it, like so:if (variable_get('pathauto_update_action', 2) > 0 && !module_exists('path_redirect')) {.. and then (perhaps) note somewhere that there's a new update action available. (I'm a bit busy, but I'll try and think more on this and get back. Just thought I'd get my immediate thoughts out. :))
Comment #8
dave reidThe problem is that the first two options leave the existing url alias intact. In those two cases, performing redirects is useless because the path.module intercepts and loads the correct node/x in $_GET['q']. The only way for redirects to work is if the old alias is deleted, which is only in option 2.
Comment #9
Freso commented@ Dave Reid: That's because you're thinking about this "programmatically" (ie., what happens behind the scenes) instead of "semantically" (ie., what the end user experiences). In this case, the first two options allows the content to still be accessed at the old URI/(perceived) location, while the third one makes the content completely unavailable at the old URI/(perceived) location. Looking at it from this angle, it doesn't make sense to have the URI still work, if that's not the intention.
Comment #10
greggles#434464: Odd behaviour with updated aliases.
6.1. Is about a hook_requirements. I'd rather have this message within the pathauto settings so that it is within the context of the Pathauto module. Maybe having it at hook_requirements as well is a good idea.
6.2. I'm not sure about the idea of overloading the behavior of the update action so that it changes depending on having a module installed.
Another way to get this message across is to change the way we build the Update Actions radio buttons so that the 4th option to "Create a new alias. Redirect from old alias." is always visible but is disabled until path redirect is installed (and we would provide help text that mentions this).
Comment #11
damienmckennaCould it be handled the other way, could there be a hook for other modules (i.e. path_redirect) to jump in and handle the old URL?
Comment #12
greggles@DamienMcKenna - I don't know what you mean? Path redirect does jump in and handle the older URL if it's installed and enabled.
Comment #13
damienmckennaOk, just ignore me, I guess my glasses were dirty or something, there are *lots* of references to path_redirect in pathauto.inc.
Comment #14
dave reidPatch attached for HEAD/6.x-2.x that will always expose the redirect option, but disable it if path_redirect is not enabled. Also attached screenshots of the pathauto settings when path_redirect is disabled before and after the patch.
Comment #15
dave reidRevised patch and summary:
1. Always shows the redirect alias update option, but disables it if path_redirect is not enabled. This will get users to notice that the option is available instead of hiding it.
2. When users install pathauto and path_redirect is already enabled, then it will set the default action to redirect aliases instead of delete the old alias.
3. Will show a message at admin/reports/status if path_redirect is not enabled and the delete old alias update action is selected.
4. Changes the suggests[] = path_redirect in pathauto.info to recommends[] = path_redirect for a stronger relation.
Comment #16
dave reidComment #17
dave reidComment #18
dave reidBumping to 7.x-1.x/6.x-2.x since it would change strings.
Comment #19
dave reidThis is being superceded by #971552: Integration with Redirect Module Not Working (or not present) now.