Hello I am using book_copy module for creating a new version of the book so i have copied a book which is having more than 1000 pages with the book copy module. Now the new book copy has all working links but for the new book i needed the new urls. like for previous book it was content/2012 now i needed content/2013 which i have done with pathauto but problem is that while copying a book it takes url for pages as content/2013 but in the page there are hyperlinks which are not updated and pointing to old book pages. So let me know if any module for fixing this issue o/w i need to go on each link and update it which is really a difficult task.
1 Answer
Export the database, run a find and replace over the dumped sql and re-import it.
e.g.:
#1 mysqldump ... > output.sql
#2 copy output.sql to output_mangled.sql as a backup
#3 perl -pi -e 's/content\/2012/content\/2013/' output.sql
#4 cat output.sql | mysql ...
Replacing ... with authentication and database specification parameters.
To be safer, make the regular expression in the replacement step more specific.
-
-
OK. i) keep copy of output.sql ii) limit tables to field_* iii) try to match your sql as carefully as possible (check for href around) iv) test thoroughly. Since you have a backup of the database it can't be destructive Apr 19, 2013 at 13:17
-
Sorry, a string substitution on an SQL dump for varchar/text data is just a bad idea. Reading every piece of content in the site (not to mention variables, titles, and a plethora of other text data in a Drupal site) to make sure the replacement hasn't messed anything up is just untenable. The correct way to handle this would be a custom filter– Clive ♦Apr 19, 2013 at 13:25
-
ok but i needed to modify all hyperlinks at one go.so how is it possible. Apr 22, 2013 at 7:39
-
If you don't want to play with the sql you could export the content, then find-and-replace then reimport. Feeds export/import, migrate module or one of the other data migration tools. Apr 23, 2013 at 11:25