tags:

views:

45

answers:

3

After importing content from a legacy website using the Feeds module, I'm left with node bodies that contains links back to the old website.

Is there a Drupal module that will perform a one-time process to iterate through each node, manipulating the content of nodes using some custom code?

+2  A: 

You could easily write a PHP script to step through the node_revisions table and do your processing there. If you're comfortable with custom code, it's probably the fastest way.

ceejayoz
A: 

You could write your own module with the intent of running it once. There is a Drupal hook_init() you can utilize to fire code when a module is on, and the page is loaded up. Within that function, you can query against all the nodes in the node table with db_query, iterate over each node and do a preg_replace on the link you want to change. After modifying the $node object, use node_save($node) at the end of the loop to save the node changes.

Alternatively, you can use a module like Link Checker, Path Redirect and/or Global Redirect to link old paths to new ones and look for busted links.

Kevin
A: 

I usually run an SQL query in phpMyAdmin. See my post on http://drupal.org/node/718700#comment-2616682.

marcvangend

related questions