{path_redirect}.rid not updated to a serial field from 5.x upgrade

drfuzetto - April 1, 2008 - 21:42
Project:Path Redirect
Version:6.x-1.0-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a path redirect setup for sales/index.html to sales and it returns this:
sales?q=sales/index.html

and of course the page is not found.

I have many other redirects similar to this that are working fine.

All of my directs are permanent and there are no queries or anchors.

Any ideas as to what is going on here?
Deborah fuzetto

#1

HorsePunchKid - April 1, 2008 - 21:52
Status:active» postponed (maintainer needs more info)

Can I ask what server you're using? I'm also curious whether your redirect ends up using drupal_goto or the relatively new path_redirect_goto. You could test that by adding a line like this to the latter function (~line 196):

<?php
watchdog
('path_redirect', 'Called path_redirect_goto with $path = ['. $path .'] and $query = ['. $query .'].');
?>

#2

drfuzetto - April 2, 2008 - 19:12

I am using a Linux server.

I added the debug line and it did not show up in my logs. What does this mean? Do I want it to call the function in the module or the Drupal function?

Also after some more testing I found that in the path_redirect_init function it doesn't get to any of the "if" statements under the comment
// only redirect if allow_bypass is off or bypass is not requested

What is the $_GET['redirect'] variable?

#3

Shane Birley - April 16, 2008 - 20:42

Actually, I can't get this module to work at all. The redirects fail every time no matter what 300 setting the redirect is on. I have attempted:

- /node/#
- /url-alias (generated aliases by path auto)

It doesn't error out, there are no errors in the log. It is like the module isn't even turned on. One thing I did notice was when I edited the aliases, the path grew in length each time I saved it. For example:

1. I create the redirect. Redirect /this-is-the-url to random external URL
2. I save the redirect.
3. I click edit.
4. I save again (no changes are made).
5. The url is now: /this-is-the-urlthis-is-the-url

I saved the URLs several times and it grew to:

/this-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-urlthis-is-the-url

#4

HorsePunchKid - April 16, 2008 - 20:44

Can you confirm that you're seeing that behavior in the latest 6.x dev release?

#5

Shane Birley - April 16, 2008 - 20:46

Sorry, the version I am on is the latest 5.x dev. Should I create a new issue?

#6

HorsePunchKid - April 16, 2008 - 21:00

You may if you like, but I think I know the problem. Could you try out this hastily crafted patch? Sorry, I can't test it myself at the moment, but I'll be working on this tonight with the goal of getting the next release out.

AttachmentSize
foo.patch 679 bytes

#7

Shane Birley - April 16, 2008 - 21:46

I patched the module and your patch appears to have fixed the problem both the URL redirect and the issue with the growing URL. I will test it on a couple of other sites and see if the patch holds.

And - you rock! Thanks! I thought I was doing something wrong or using the module incorrectly.

#8

HorsePunchKid - April 16, 2008 - 23:04

Okay, I've committed that patch. It will take a while for the dev version to be regenerated. I'll leave this issue open to hopefully address drfuzetto's problem.

#9

kyle_mathews - May 17, 2008 - 18:55

Ummm... this patch never got into a new version for drupal 6. Could you check what's wrong? I just moved my blog from wordpress to drupal 6 and need to set some redirects so everything works right.

I'm getting this error right now.

user warning: Duplicate entry '0' for key 1 query: INSERT INTO path_redirect (path, redirect, query, fragment, type) VALUES ('test', 'testdf', '', '', '301') in /home/.enola/kylemathews/kyle.mathews2000.com/sites/all/modules/path_redirect/path_redirect.module on line 139.

#10

organizedhome - June 29, 2008 - 15:44

Another user with the same problem; am trying to install and use the current dev version for 6.2.

Database is a test site with Drupal 5.7 -> 6.2 upgrade, and I can't create a redirect. Error:

user warning: Duplicate entry '0' for key 2 query: INSERT INTO path_redirect (path, redirect, query, fragment, type) VALUES ('whats-christmas-countdown', 'node/647', '', '', '301') in /home/site2/html/sites/all/modules/path_redirect/path_redirect.module on line 139.

Thanks for looking into this.

Cynthia

#11

organizedhome - June 29, 2008 - 17:21

I've managed to fix the error, and for me, it wasn't the code, it was the path_redirect table settings that were buggy.

At some point since I first installed the module in Drupal 5, the path_redirect database table changed. Specifically, the old table I was trying to use (originally created in Drupal 5, then upgraded to 6), had incorrect settings.

Specifically, field nid was not set to auto_increment, and fields query and fragment did not allow nulls.

To fix the problem, I uninstalled path_redirect module and manually removed the path_redirect table from the database. Then I reinstalled path_redirect, which installed a new table with the correct field settings.

Then I restored data from a sql dump of the old drupal 5 database. I can now see all my redirects, and add, edit or delete entries properly. It was just a matter of getting the correct field settings and replacing the data.

May help somebody else save a few hours.

#12

rootwork - August 7, 2008 - 20:41

Just wanted to report that I had this problem too and this solution fixed it perfectly. Thanks!

#13

escoles - August 18, 2008 - 12:16

Specifically, field nid was not set to auto_increment, and fields query and fragment did not allow nulls.

Sorry, did you mean 'nid' or 'rid'? In my path_redirect table the field is called 'rid'. (V. 5.x, not 6.x, if that makes a difference.) (Thinking it should be 'rid', for 'redirect ID'.)

#14

greggles - December 5, 2008 - 17:47
Status:postponed (maintainer needs more info)» active

Yeah, there is a problem in the 6.x-1.x-dev version where the rid column needs to be changed to be auto_increment.

I'm not sure this is completely the right way to do it, but running this query seemed to solve the problem for me:

alter table path_redirect modify rid int(10) not null auto_increment;

#15

Dave Reid - January 27, 2009 - 18:52
Title:redirect not consistently working» {path_redirect}.rid not updated to a serial field from 5.x upgrade

Hmm...not sure how to approach this upgrade with a fix.

#16

greggles - January 27, 2009 - 19:14

I'd say update the schema definition and do a db_change_field to make it a serial, no?

#17

Dave Reid - January 27, 2009 - 19:22
Version:6.x-1.x-dev» 5.x-1.x-dev

Looks like the update will need to be on the 5.x .install since this issue will be affecting those users upgrading from the 5.x to 6.x version of the module.

#18

Dave Reid - January 27, 2009 - 23:49
Status:active» fixed

Alright, I committed a new update that should prepare any 5.x path_redirect table to match the 6.x defined schema.

#19

System Message - February 10, 2009 - 23:50
Status:fixed» closed

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

#20

vacilando - February 20, 2009 - 22:47

Same problem in D6.9 (after upgrade from D5.15) -- cannot create new redirects and the above error appears :-(

I wonder if there a more elegant solution than having to drop the table etc.

#21

richard.e.morton - February 22, 2009 - 20:23

I have this problem also I was redirected from here
http://drupal.org/node/319531

user warning: Duplicate entry 'taxonomy/term/15-' for key 2 query: UPDATE url_alias SET src = 'taxonomy/term/', dst = 'taxonomy/term/15', language = '' WHERE pid = 3 in /var/www/vhosts/nafof.org.uk/httpdocs/modules/path/path.module on line 100.

Rich

#22

richard.e.morton - February 22, 2009 - 20:58
Version:5.x-1.x-dev» 6.x-1.0-beta1
Status:closed» active

#23

Dave Reid - February 23, 2009 - 00:49
Status:active» postponed (maintainer needs more info)

@richard.e.morton: If that's the only error you have seen, there's no problem with path_redirect, and instead with core's path.module or pathauto.

@vacilando: Did you upgrade to the latest 5.x-1.x version of path_redirect before you upgraded to Drupal 6? Right now that's the only supported upgrade path that will work.

#24

vacilando - February 23, 2009 - 09:35

@Dave Reid -- no, the D5 version was patched after I discovered the problem in D6, so by definition it is impossible for me to patch it in D5. Note this is a problem one does not notice immediately after D6 upgrade - it only surfaces after you want to add redirects. Suggestion: perhaps the D6 version's version could simply be adapted so that when update.php is run, the table is checked for the auto_increment property, and if it's not there, it would be added.

#25

Dave Reid - November 4, 2009 - 04:40
Status:postponed (maintainer needs more info)» fixed

This should be fixed for any users updating after the fix was committed. If you upgraded before, just change the {path_redirect}.rid to an auto-increment or serial column.

#26

System Message - November 18, 2009 - 04:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.