Node Renumber

Component ID

1339934

Component name

Node Renumber

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Changes the $node->nid value on existing content.

POWER USERS ONLY.
There are reasons why this is not a normal feature of Drupal, but sometimes you just need to do this.

Drupal 7 only right now.

This is an admin/dev only module. A number of things may go wrong and data loss can happen if used without care.

It's built and intended to rationalize and repair node ID inconsistencies arising from content migration processes where nids were not persistent, but for technical reasons ... need to be maintained or re-instated.

Use case : A site migration using feeds.

The data was successfully migrated perfectly, but a number of old URL links (offsite) referred directly to /node/nid links. Which now are incorrect.

It's just tidier to force the migrated content to use the same numbering as the original.

Warning - this has not been tested with complex content types

It only works up to the point where the data I was migrating (from a D7-alpha site that had no upgrade path) started working enough. Additional content tweaks and manual intervention may still be required if using anything outside of core+cck.
Certainly don't use this in association with nodereference, although filefield transformations seem to have survived.

Usage

A new tab is presented on node/node-edit pages called 'renumber'.
There you are asked what you would prefer the new nid to be.
On submission:
- any existing node in that space is given a new nid, via a simple clone+delete
- the source node is cloned into the target nid location and the original removed.
resulting in the target node having a new nid.
Complex, non-cck data may be lost, left behind or cause integrity issues in your DB! Almost no contrib modules are expected to be able to deal with renumbering, so a versioned clone and then an API-based delete is used. This encompasses most of the needed functionality. Apart from that, so far, all the data I was looking for has been successfully migrated.

You should only try this module if you are comfortable with the database storage layer of Drupal and its implications. And never on a live site without a backup trial first.

See also


Built as part of the New Zealand Government Web Standards project, by dman, the New Zealand Drupal Developer