I recently dealt with upgrading a Node Hierarchy Drupal 5.x site to 6.x and ran into some serious issues with the 6.x-1.x to 6.x-2.x process.

  • The hook_update attempts to update menu links by nids numerically, but would break if an lower node was a child of a higher node.
  • Nodes that didn't have menu items previously had them unnecessarily created during the upgrade, making a mess of the menus
  • The original "nodehierarchy" table was left, even though it wasn't in use anymore.

The following patch addressed all of these issues. As the patch is rather intense, I'm not committing it quite yet, and would appreciate it if someone could test it in their environments. Unfortunately, it isn't currently possible to fix an previously upgraded site.

Comments

jbylsma’s picture

Patch attached.

garretg’s picture

Hello Jonny. Thanks for all your work on Node Hierarchy...

I'm working on upgrading a D6, NH 1.x site right now (to D6, NH 2.1)... and I was seeing several of the issues you describe in this issue. The biggest problem was that child nodes with a lower nid than a parent did not get upgraded properly.

So I'm testing your patch... one thing though... it seems to me to have been generated backwards?

You submitted this bug report and patch in mid 2012. But when I apply it to either the NH 2.1 release, or the latest 2.x-dev, the patches are rejected. And studying the code, those releases seems to already have the context and your additions?

Those codebases were packaged in April 2011 and December 2011. (months before you reported this bug).

I tried applying the patch file with -R... but that didn't work. But I believe it's often not possible... depends on how much context has been included, and the chances of fate.

After puzzling over your patch file for some time, I think I was able to manually reverse and apply your patches... and indeed if I diff my new file backwards with the latest 2.x-dev, I get your patch file.

As for the patches themselves... so far so good! Upgrading my site with your patches in place worked fine.. and it has resolved the "child node with a lower nid than a parent" issue.

Cheers,
-Garret